コード例 #1
0
        public void Details_GivenIdOfUnknownDebtor_ThrowsException()
        {
            // Arrange
            var fakeDebtorRepository = A.Fake<IDebtorRepository>();
            A.CallTo(() => fakeDebtorRepository.FindById(2)).Returns(null);
            var controller = new DebtManagementPlanController(fakeDebtorRepository);

            // Act, Assert
            Assert.Throws<InvalidOperationException>(() => controller.Details(2, null));
        }
コード例 #2
0
        public void Details_GivenIdOfKnownDebtor_ReturnsAViewResultWithCorrectViewModelType()
        {
            // Arrange
            var fakeDebtorRepository = A.Fake<IDebtorRepository>();
            var stubDomainDebtor = DebtorBuilder.Build(2);
            A.CallTo(() => fakeDebtorRepository.FindById(2)).Returns(stubDomainDebtor);
            var controller = new DebtManagementPlanController(fakeDebtorRepository);

            // Act
            var viewResult = controller.Details(2, null) as ViewResult;

            // Assert
            Assert.That(viewResult.Model, Is.InstanceOf<DebtManagementPlanViewModel>());
        }
コード例 #3
0
        public void Details_GivenIdOfKnownDebtor_ReturnsAViewResult()
        {
            // Arrange
            var fakeDebtorRepository = A.Fake<IDebtorRepository>();
            var stubDomainDebtor = DebtorBuilder.Build(2);
            A.CallTo(() => fakeDebtorRepository.FindById(2)).Returns(stubDomainDebtor);
            var controller = new DebtManagementPlanController(fakeDebtorRepository);

            // Act
            var actionResult = controller.Details(2, null);

            // Assert
            Assert.That(actionResult, Is.InstanceOf<ViewResult>());
        }