public void AddLeft(string id, string left) { if (string.IsNullOrWhiteSpace(left)) { throw new ArgumentNullException("Left"); } if (string.IsNullOrWhiteSpace(id)) { throw new ArgumentNullException("Id"); } var newValue = new Comparison() { ComparisonId = id, Left = left }; //We check if the id already exists var entity = _comparisonRepository.Get(id); if (entity != null) { //If It does exist, we update the value entity.Left = newValue.Left; _comparisonRepository.Update(entity); } else { _comparisonRepository.Insert(newValue); } }
public void Given_Valid_Data_When_Insert_Data_Should_Not_Throw_Exception() { //Arrange var id = _fixture.Create <string>(); var base64string = _fixture.Create <string>().Base64Encode(); var comparison = new Comparison() { ComparisonId = id, Left = base64string, Right = base64string }; //Act & Assert Assert.DoesNotThrow(() => _repository.Insert(comparison)); }