コード例 #1
0
        public void Index_StateUnderTest_ExpectedBehavior()
        {
            // Act
            var result = _availabilityController.Index();

            // Assert
            Assert.IsInstanceOf(typeof(ViewResult), result);
        }
コード例 #2
0
        public void Index_NoUserAvailabilitiesExist_ShouldReturnAvailabilityViewWithEmptyAvailability()
        {
            //Arrange
            int totalPages;
            IEnumerable <UserAvailability> availabilities = new UserAvailability[] { };

            _mockService.Setup(r => r.GetFutureUserAvailabilitiesPaged(_userId, 0, out totalPages, null))
            .Returns(availabilities);

            //Act
            var result = _controller.Index() as ViewResult;
            var model  = result.Model as AvailabilityViewModel;

            //Assert
            result.Should().NotBeNull();
            result.ViewName.Should().Be("Availability");
            model.Availability.Should().HaveCount(0);
            model.Controller.Should().Be("Availability");
            model.Action.Should().Be("Index");
        }