コード例 #1
0
        public void ShouldReturn404StatusWhenLoanIdNotExists()
        {
            var fakeRepository = new Mock <IRepository>();

            var sut = new LoanApplicationSearchController(fakeRepository.Object);

            sut.WithCallTo(x => x.ApplicationStatus(99)).ShouldGiveHttpStatus(HttpStatusCode.NotFound);
        }
コード例 #2
0
        public void ShouldRenderApplicationWhenIdExists()
        {
            var fakeRepository = new Mock <IRepository>();

            fakeRepository.Setup(x => x.Find(It.IsAny <int>())).Returns(new LoanApplication {
                FirstName = "Larry"
            });

            var sut = new LoanApplicationSearchController(fakeRepository.Object);

            sut.WithCallTo(x => x.ApplicationStatus(99))
            .ShouldRenderDefaultView()
            .WithModel <LoanApplication>(x => x.FirstName.Equals("Larry"));
        }