예제 #1
0
        public void FailInUpdateNotExistLodgingTest()
        {
            var lodgingRepositoryMock = new Mock <ILodgingRepository>(MockBehavior.Strict);

            lodgingRepositoryMock.Setup(m => m.Get(It.IsAny <Guid>())).Throws(new ClientException());
            lodgingRepositoryMock.Setup(m => m.Update(It.IsAny <Lodging>()));
            LodgingManagement lodgingLogic   = new LodgingManagement(lodgingRepositoryMock.Object);
            Lodging           resultOfUpdate = lodgingLogic.UpdateLodging(lodging.Id, lodging);
        }
예제 #2
0
        public void FailInUpdateLodgingWithAnyErrorFieldTest()
        {
            lodging.Address = "";
            var lodgingRepositoryMock = new Mock <ILodgingRepository>(MockBehavior.Strict);

            lodgingRepositoryMock.Setup(m => m.Get(It.IsAny <Guid>())).Returns(lodging);
            lodgingRepositoryMock.Setup(m => m.Update(It.IsAny <Lodging>()));
            LodgingManagement lodgingLogic   = new LodgingManagement(lodgingRepositoryMock.Object);
            Lodging           resultOfUpdate = lodgingLogic.UpdateLodging(lodging.Id, lodging);
        }
예제 #3
0
        public void UpdateValidLodgingTest()
        {
            lodging.Name = "San Ramon Hotel";
            var lodgingRepositoryMock = new Mock <ILodgingRepository>(MockBehavior.Strict);

            lodgingRepositoryMock.Setup(m => m.Get(It.IsAny <Guid>())).Returns(lodging);
            lodgingRepositoryMock.Setup(m => m.Update(It.IsAny <Lodging>()));
            LodgingManagement lodgingLogic   = new LodgingManagement(lodgingRepositoryMock.Object);
            Lodging           resultOfUpdate = lodgingLogic.UpdateLodging(lodging.Id, lodging);

            lodgingRepositoryMock.VerifyAll();
            Assert.IsTrue(resultOfUpdate.Name.Equals("San Ramon Hotel"));
        }