public void SaveShouldThrownArgumentOutOfRangeExceptionWhenItemTypeIsInvalid() { // Arrange var someValidId = 1; var invalidItemType = (DiffItemType)int.MinValue; var repositoryManager = new DiffRepositoryManager(_defaultRepositoryMock.Object, _defaultMapperMock.Object); // Act var result = repositoryManager.Save(someValidId, _validBase64string, invalidItemType); }
public void SaveShouldThrownFormatExceptionWhenDataIsNotValidBase64String() { // Arrange var someValidId = 1; var invalidBase64string = "invalidBase64string"; var someValidItemType = DiffItemType.Left; var repositoryManager = new DiffRepositoryManager(_defaultRepositoryMock.Object, _defaultMapperMock.Object); // Act var result = repositoryManager.Save(someValidId, invalidBase64string, someValidItemType); }
public void SaveShouldThrownArgumentNullExceptionWhenDataIsNull() { // Arrange var someValidId = 1; var data = default(string); var someValidItemType = DiffItemType.Left; var repositoryManager = new DiffRepositoryManager(_defaultRepositoryMock.Object, _defaultMapperMock.Object); // Act var result = repositoryManager.Save(someValidId, data, someValidItemType); }
public void SaveShouldPersistTheDataInRepositoryWhenAllParametersAreValid() { // Arrange var someValidId = 1; var someValidItemType = DiffItemType.Left; var repositoryMock = new Mock <IRepository>(); var repositoryManager = new DiffRepositoryManager(repositoryMock.Object, _defaultMapperMock.Object); // Act repositoryManager.Save(someValidId, _validBase64string, someValidItemType); // Assert repositoryMock.Verify(r => r.Save(It.IsAny <InMemoryDiffData>())); }