public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock<IDbSet<Object>> mockSetObjects; var mockContext = ObjectsMockingSetup.DoMockingSetupForContext(false, out mockSetObjects); var repository = new ObjectsRepository(mockContext.Object); var objects = new Object { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(objects); // Assert mockSetObjects.Verify(x => x.Add(objects), Times.Once); }
public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock <IDbSet <Object> > mockSetObjects; var mockContext = ObjectsMockingSetup.DoMockingSetupForContext(false, out mockSetObjects); var repository = new ObjectsRepository(mockContext.Object); var objects = new Object { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(objects); // Assert mockSetObjects.Verify(x => x.Add(objects), Times.Once); }