예제 #1
0
        public void CreateShouldCreateLinks()
        {
            // arrange
            var person = new Person();

            _configurationProviderMock.Setup(cp => cp.GetLinksFor(typeof(Person), person)).Returns(new List <IHateoasLink>());

            var request = new HttpRequestMessage();

            var configuration = new HttpConfiguration();

            request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, configuration);
            var response = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new ObjectContent(person.GetType(), person, new JsonMediaTypeFormatter(), "application/json")
            };

            // act
            var content = _responseProvider
                          .CreateLinks(response);

            // assert
            content.Should().NotBeNull()
            .And.BeOfType <List <IHateoasLink> >()
            .And.HaveCount(0);
        }