 ALWAYS enjoy the photographs on the “Letters to the Editor” page. The one printed (The Yorkshire Post, April 17) indicates that the purple saxifrage was in bloom on Ingleborough. My memory of seeing this lovely flower is of seeing it on Pen-y-Ghent, which I think is where your photograph was taken.
What about paper buds?
THE Government is, quite rightly, planning to ban various “throw-away” plastic items, in a bid to lead the way in trying to save the planet from the scourge of plastic pollution. One of these items is cotton buds (The Yorkshire Post, April 20). I hope that they are aware that there are brands of cotton buds whose sticks are made of compressed paper, not plastic. These need to be excluded from any ban.
DOES it really matter who destroyed the landing cards of some of the Windrush generation? Surely the time debating this issue would be better spent making the situation right and compensating those who suffered?Our children's bedrooms are often the most difficult rooms to decorate. They have to be the most functional, safe, and fun rooms in the...
In observance of black history month this February, I compiled a list of books that highlight racial diversity and celebrate African-American history. Here are...
I feel like Christmas sneaks up on me every year. I don't have all my decorations out until the night before, I can't seem...
It's fall, y'all! I always get excited about this particular season change—drawing pictures of pumpkins on our dry-erase calendar, making substitutions in my closet (hello, boots!), and even...
Hi, my name is Hayley, and I am a book junkie. I buy them used, I buy them new and my house is bursting...
As I look out on a fresh year, and as I start filling in my empty, full of possibilities May Designs calendar, I can't help...Patrice Evra has claimed there are at least two gay footballers at each club in the world, but he believes some of his former teammates were afraid to come out due to homophobic attitudes.
There are currently no openly gay players in the Premier League, but efforts have been to make English football more inclusive through the Rainbow Laces campaign.
The former left-back, who played for Manchester United and Juventus among others, has revealed his own eye-opening experiences during his playing career.
“When I was in England, they brought someone to talk to the team about homosexuality,” Evra told Le Parisien.
.”
Evra‘s comments come just days after gay Australian footballer Josh Cavallo called out homophobic abuse which was aimed at him during an A-League match on Saturday.
Evra on Mbappe
The Frenchman also discussed Paris Saint-Germain star Kylian Mbappe, suggesting he has the personality of a politician.
“He is an educated guy and I like him,” Evra said.
“But, I have the feeling that he is hiding something. When I hear him speak, I feel like I’m listening to a political representative and not a footballer.
“I hope that on the pitch he thinks about the team and not his personal goals, because the star is the team, not a single player.”﻿using System.Net.Http;
using System.Net.Http.Headers;
using Castle.Core.Internal;
using EasyStub.Common;
using EasyStub.Common.Request;
using EasyStub.Common.Response;
using EasyStub.Core;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using Ploeh.AutoFixture;
using Encoding = System.Text.Encoding;

namespace EasyStub.Test.Server
{
    public class ModelTransformerFixture : FixtureBase<ModelTransformer>
    {
        [Test]
        public void TransformRequest_ShouldInvokePostProcessorBeforeReturning()

        {
            var httpRequestModel = Fixture.Freeze<HttpRequestModel>();
            var request = Fixture.Build<HttpRequestMessage>()

               .Create();
            Fixture.Freeze<Mock<IRequestModelProcessor>>()
               .Setup(s => s.Execute(It.IsAny<HttpRequestModel>()))
               .Returns(httpRequestModel);
            Sut.Transform(request
                ).Should().Be(httpRequestModel);
        }


        [Test]
        public void TransformResponse_ShouldNotSupplyCharSetMediaType_WhenBothMissing()
        {
            var response = Fixture.Build<HttpResponseModel>().Without(s=>s.Body).Create();
            response.Body = new Body() {Data = "hi mom!"};
            var exepcted = new StringContent("hi mom");
            Sut.Transform(response).Content.ShouldBeEquivalentTo(exepcted);
        }
        [Test]
        public void TransformResponse_ShouldNotSupplyCharSetMediaType_WhenEitherMissing()
        {
            var response = Fixture.Build<HttpResponseModel>().Without(s => s.Body).Create();
            response.Body = new Body() { Data = "hi mom!",ContentType = new ContentType() {CharSet = Encoding.Default.WebName } };
            var exepcted = new StringContent("hi mom");
            Sut.Transform(response).Content.ShouldBeEquivalentTo(exepcted);
        }

        [Test]
        public void TransformRequest_ShouldReturnAllAttributes()
        {
            var request = Fixture.Create<HttpRequestMessage>();
            var httpRequestModel = TransformModel(request);
            var processor = Fixture.Freeze<Mock<IRequestModelProcessor>>();
            processor.Setup(s => s.Execute(It.IsAny<HttpRequestModel>())).Returns((HttpRequestModel rm) => rm);
            Sut.Transform(request).ShouldBeEquivalentTo(httpRequestModel);
        }
       
        private HttpRequestModel TransformModel(HttpRequestMessage request)
        {
            var content = new StringContent(Fixture.Create<string>());
            content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            request.Content = content;
            request.Headers.Add("Accept-Encoding", "gzip, deflate");
            request.Headers.Add("Forwarded", "for=192.0.2.43, for=198.51.100.17");

            var body = new Body()
            {
                Data = request.Content.ReadAsStringAsync().Result,
                ContentType = new ContentType()
                {
                    MediaType = content.Headers.ContentType.MediaType,
                    CharSet =
                        content.Headers?.ContentType.CharSet!= null
                           ? Encoding.GetEncoding(content.Headers?.ContentType?.CharSet).WebName
                            : null
                }
            };
            var method = request.Method;
            var query = request.RequestUri.Query;
            var port = request.RequestUri.Port;
            var headers = new Headers();
            request.Headers.ForEach(h => headers.Add(h.Key, string.Join(",", h.Value)));
            string localPath = request.RequestUri.LocalPath;
            return new HttpRequestModel(body, method, headers, query, localPath, port);
        }

        [Test]
        public void TransformResponse_ShouldReturnCorrectResponse_WhenAllAttributesPresent()
        {
            var httpResponseModel =
                Fixture.Build<HttpResponseModel>()
                   .With(m => m.Body,
                        new Body()
                        {
                            Data = "",
                            ContentType = new ContentType() {MediaType = "application/xml", CharSet = Encoding.Default.WebName }
                        })
                   .Create();
            httpResponseModel.Headers.Add("Accept-Encoding", "gzip, deflate");
            httpResponseModel.Headers.Add("Forwarded", "for=192.0.2.43, for=198.51.100.17");

            var httpResponseMessage = GetExpectedResponse(httpResponseModel);

            Sut.Transform(httpResponseModel).ShouldBeEquivalentTo(httpResponseMessage);
        }

        private object GetExpectedResponse(HttpResponseModel httpResponseModel)
        {
            HttpResponseMessage httpResponseMessage = new HttpResponseMessage
            {
                StatusCode = httpResponseModel.StatusCode
            };
            httpResponseModel.Headers.Dictionary.ForEach(s => httpResponseMessage.Headers.Add(s.Key, s.Value.ToString()));
            var content = new StringContent(httpResponseModel.Body.Data, Encoding.GetEncoding(httpResponseModel.Body.ContentType.CharSet), httpResponseModel.Body.ContentType.MediaType);
            httpResponseMessage.Content = content;
            return httpResponseMessage;
        }

        [Test]
        public void TransformResponse_ShouldSetCorrectCharset_WhenPresent()
        {
            var content = new StringContent(Fixture.Create<string>(), Encoding.UTF8, "application/xml");

            var httpResponseModel =