示例#1
0
        public void UodHttpGet()
        {
            // Arrange
            List <UodSummaryModel> expectedSummaries = new List <UodSummaryModel>()
            {
                new UodSummaryModel()
                {
                    Average = "1000", Brutto = "15000"
                }
            };

            _sessionMock.Setup(x => x.GetFromSession <List <UodSummaryModel> >(SessionItem.Uod))
            .Returns(expectedSummaries);

            // Act
            ActionResult result = _controller.Uod();

            // Assert
            _sessionMock.Verify(x => x.GetFromSession <List <UodSummaryModel> >(SessionItem.Uod), Times.Once);

            result.Should().NotBeNull().And.BeOfType <ViewResult>();
            ViewResult viewResult = result as ViewResult;

            viewResult.Model.Should().NotBeNull().And.BeOfType <UodModel>();
            var model = viewResult.Model as UodModel;

            model.BruttoAmountPerMonth.Should().BeGreaterThan(0);
            model.Limit.Should().BeGreaterThan(0);
            model.SavedSummaries.Should().Equal(expectedSummaries);
        }