public void MultimediaLinkService_Update_Calls_UnitOfWork_Commit_Method_() { // Create test data var multimediaLink = new MultimediaLink { File = "Foo" }; //Create Mock _mockUnitOfWork = new Mock<IUnitOfWork>(); var mockRepository = new Mock<IRepository<MultimediaLink>>(); _mockUnitOfWork.Setup(d => d.GetRepository<MultimediaLink>()).Returns(mockRepository.Object); //Arrange _service = new MultimediaLinkService(_mockUnitOfWork.Object); //Act _service.Update(multimediaLink); //Assert _mockUnitOfWork.Verify(db => db.Commit()); }
public void MultimediaLinkService_Update_Calls_Repository_Update_Method_With_The_Same_MultimediaLink_Object_It_Recieved() { // Create test data var multimediaLink = new MultimediaLink { File = "Foo" }; //Create Mock _mockUnitOfWork = new Mock<IUnitOfWork>(); var mockRepository = new Mock<IRepository<MultimediaLink>>(); _mockUnitOfWork.Setup(d => d.GetRepository<MultimediaLink>()).Returns(mockRepository.Object); //Arrange _service = new MultimediaLinkService(_mockUnitOfWork.Object); //Act _service.Update(multimediaLink); //Assert mockRepository.Verify(r => r.Update(multimediaLink)); }