Esempio n. 1
0
        public void It_Should_Return_True_When_Saved_An_Entry()
        {
            //Arrange
            repositoryServiceMock.Setup(s => s.Save(It.IsAny <MortgageEntry>())).Verifiable();

            MortgageService service = new MortgageService(repositoryServiceMock.Object);

            //Act
            var result = service.SaveCalculationEntry(_mortgageEntry);

            //Assert
            Assert.AreEqual(result, true);
        }
Esempio n. 2
0
        public void It_Should_Call_Save_When_Saving_An_Entry()
        {
            //Arrange
            repositoryServiceMock.Setup(s => s.Save(It.IsAny <MortgageEntry>())).Verifiable();

            MortgageService service = new MortgageService(repositoryServiceMock.Object);

            //Act
            var result = service.SaveCalculationEntry(_mortgageEntry);

            //Assert
            repositoryServiceMock.Verify(r => r.Save(It.IsAny <MortgageEntry>()), Times.Once());
        }
Esempio n. 3
0
        public void It_Should_Return_False_When_Saving_An_Entry_And_Exception_Is_Thrown()
        {
            //Arrange
            repositoryServiceMock.Setup(s => s.Save(It.IsAny <MortgageEntry>())).Throws(new NotImplementedException());

            MortgageService service = new MortgageService(repositoryServiceMock.Object);

            //Act
            var result = service.SaveCalculationEntry(_mortgageEntry);

            //Assert
            Assert.AreEqual(result, false);
        }