Beispiel #1
0
        public void getConference()
        {
            // Arrange
            ConferenceController controller = new ConferenceController();

            var actResult = controller.Get(1);
            // Act
            var result = actResult as OkNegotiatedContentResult <Conference>;

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Content.ID == 1);
        }
        public void should_unit_the_conference_service_to_return_the_conference_data()
        {
            var theConferenceInfo = new ConferenceInfo();
            var conferenceService = new Mock <IConferenceService>();

            conferenceService.Setup(x => x.ConferenceInfo()).Returns(theConferenceInfo);
            var controller = new ConferenceController(conferenceService.Object);

            var result = controller.Get();

            Assert.IsType <ConferenceInfo>(result);
            Assert.Equal(result, theConferenceInfo);
        }
Beispiel #3
0
        public async void Get()
        {
            // Arrange
            var expected = GetSessionResults();

            // Act
            var actionResult = await controller.Get();

            // Assert
            var objectResult = Assert.IsType <OkObjectResult>(actionResult);
            var result       = Assert.IsAssignableFrom <IEnumerable <SessionResult> >(objectResult.Value);

            Assert.NotNull(result);
            Assert.Equal(expected.Count, result.Count());
            Assert.Equal(expected.First().SessionID, result.First().SessionID);
            Assert.Equal(expected.First().Title, result.First().Title);
            Assert.Equal(expected.First().Desciption, result.First().Desciption);
            Assert.Equal(expected.First().Speaker, result.First().Speaker);
            Assert.Equal(expected.First().TimeSlot, result.First().TimeSlot);
            Assert.Equal(expected.First().Href, result.First().Href);
            Assert.Equal(expected.First().Links.First().Href, result.First().Links.First().Href);
            Assert.Equal(expected.First().Links.First().Rel, result.First().Links.First().Rel);
        }