public void Verify_Get_ByKey_Should_ReturnTheCorrectObject() { // Arrange Mock <IDbSet <Object> > mockSetObjects; var mockContext = ObjectsMockingSetup.DoMockingSetupForContext(true, out mockSetObjects); var repository = new ObjectsRepository(mockContext.Object); // Act var objects = repository.Get("KING-STEPHEN"); // Assert Assert.Equal("/TEST/KING-STEPHEN", objects.ApiDetailUrl); }
public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity() { // Arrange Mock<IDbSet<Object>> mockSetObjects; var mockContext = ObjectsMockingSetup.DoMockingSetupForContext(true, out mockSetObjects); var repository = new ObjectsRepository(mockContext.Object); var objects = repository.Get(1); // Act repository.Deactivate(objects); // Assert Assert.Equal(false, objects.Active); }
public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity() { // Arrange Mock <IDbSet <Object> > mockSetObjects; var mockContext = ObjectsMockingSetup.DoMockingSetupForContext(true, out mockSetObjects); var repository = new ObjectsRepository(mockContext.Object); var objects = repository.Get(1); // Act repository.Deactivate(objects); // Assert Assert.Equal(false, objects.Active); }
public void Verify_Remove_Should_RemoveTheEntityFromTheContext() { // Arrange Mock <IDbSet <Object> > mockSetObjects; var mockContext = ObjectsMockingSetup.DoMockingSetupForContext(true, out mockSetObjects); var repository = new ObjectsRepository(mockContext.Object); var objects = repository.Get(1); // Act repository.Remove(objects); // Assert mockSetObjects.Verify(x => x.Remove((Object)objects), Times.Once); }
public void Verify_Update_Should_SetTheEntityStateToModified() { // Arrange Mock <IDbSet <Object> > mockSetObjects; var mockContext = ObjectsMockingSetup.DoMockingSetupForContext(true, out mockSetObjects); var repository = new ObjectsRepository(mockContext.Object); var objects = repository.Get(1); objects.ApiDetailUrl = "/TEST"; // Act repository.Update(objects); // Assert mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once); }
public void Verify_Get_ByID_Should_ReturnTheCorrectObject() { // Arrange Mock<IDbSet<Object>> mockSetObjects; var mockContext = ObjectsMockingSetup.DoMockingSetupForContext(true, out mockSetObjects); var repository = new ObjectsRepository(mockContext.Object); // Act var objects = repository.Get(1); // Assert Assert.Equal("/TEST/KING-STEPHEN", objects.ApiDetailUrl); }
public void Verify_Update_Should_SetTheEntityStateToModified() { // Arrange Mock<IDbSet<Object>> mockSetObjects; var mockContext = ObjectsMockingSetup.DoMockingSetupForContext(true, out mockSetObjects); var repository = new ObjectsRepository(mockContext.Object); var objects = repository.Get(1); objects.ApiDetailUrl = "/TEST"; // Act repository.Update(objects); // Assert mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once); }
public void Verify_Remove_Should_RemoveTheEntityFromTheContext() { // Arrange Mock<IDbSet<Object>> mockSetObjects; var mockContext = ObjectsMockingSetup.DoMockingSetupForContext(true, out mockSetObjects); var repository = new ObjectsRepository(mockContext.Object); var objects = repository.Get(1); // Act repository.Remove(objects); // Assert mockSetObjects.Verify(x => x.Remove((Object)objects), Times.Once); }