public void Verify_Get_ByKey_Should_ReturnTheCorrectImageFile() { // Arrange Mock <IDbSet <ImageFile> > mockSetImageFiles; var mockContext = ImageFilesMockingSetup.DoMockingSetupForContext(true, out mockSetImageFiles); var repository = new ImageFilesRepository(mockContext.Object); // Act var imageFiles = repository.Get("KING-STEPHEN"); // Assert Assert.Equal("/TEST/KING-STEPHEN", imageFiles.ApiDetailUrl); }
public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity() { // Arrange Mock<IDbSet<ImageFile>> mockSetImageFiles; var mockContext = ImageFilesMockingSetup.DoMockingSetupForContext(true, out mockSetImageFiles); var repository = new ImageFilesRepository(mockContext.Object); var imageFiles = repository.Get(1); // Act repository.Deactivate(imageFiles); // Assert Assert.Equal(false, imageFiles.Active); }
public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity() { // Arrange Mock <IDbSet <ImageFile> > mockSetImageFiles; var mockContext = ImageFilesMockingSetup.DoMockingSetupForContext(true, out mockSetImageFiles); var repository = new ImageFilesRepository(mockContext.Object); var imageFiles = repository.Get(1); // Act repository.Deactivate(imageFiles); // Assert Assert.Equal(false, imageFiles.Active); }
public void Verify_Remove_Should_RemoveTheEntityFromTheContext() { // Arrange Mock <IDbSet <ImageFile> > mockSetImageFiles; var mockContext = ImageFilesMockingSetup.DoMockingSetupForContext(true, out mockSetImageFiles); var repository = new ImageFilesRepository(mockContext.Object); var imageFiles = repository.Get(1); // Act repository.Remove(imageFiles); // Assert mockSetImageFiles.Verify(x => x.Remove((ImageFile)imageFiles), Times.Once); }
public void Verify_Update_Should_SetTheEntityStateToModified() { // Arrange Mock <IDbSet <ImageFile> > mockSetImageFiles; var mockContext = ImageFilesMockingSetup.DoMockingSetupForContext(true, out mockSetImageFiles); var repository = new ImageFilesRepository(mockContext.Object); var imageFiles = repository.Get(1); imageFiles.ApiDetailUrl = "/TEST"; // Act repository.Update(imageFiles); // Assert mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once); }
public void Verify_Get_ByID_Should_ReturnTheCorrectImageFile() { // Arrange Mock<IDbSet<ImageFile>> mockSetImageFiles; var mockContext = ImageFilesMockingSetup.DoMockingSetupForContext(true, out mockSetImageFiles); var repository = new ImageFilesRepository(mockContext.Object); // Act var imageFiles = repository.Get(1); // Assert Assert.Equal("/TEST/KING-STEPHEN", imageFiles.ApiDetailUrl); }
public void Verify_Update_Should_SetTheEntityStateToModified() { // Arrange Mock<IDbSet<ImageFile>> mockSetImageFiles; var mockContext = ImageFilesMockingSetup.DoMockingSetupForContext(true, out mockSetImageFiles); var repository = new ImageFilesRepository(mockContext.Object); var imageFiles = repository.Get(1); imageFiles.ApiDetailUrl = "/TEST"; // Act repository.Update(imageFiles); // Assert mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once); }
public void Verify_Remove_Should_RemoveTheEntityFromTheContext() { // Arrange Mock<IDbSet<ImageFile>> mockSetImageFiles; var mockContext = ImageFilesMockingSetup.DoMockingSetupForContext(true, out mockSetImageFiles); var repository = new ImageFilesRepository(mockContext.Object); var imageFiles = repository.Get(1); // Act repository.Remove(imageFiles); // Assert mockSetImageFiles.Verify(x => x.Remove((ImageFile)imageFiles), Times.Once); }