public void Create_Get_Update_Validation_Succeeds() { // Arrange ValidationEntity validationEntity = new ValidationEntity { ActiveFlag = true, ApplicationID = "Guardian", DateCreatedOffset = DateTimeOffset.UtcNow, DateModifiedOffset = DateTimeOffset.UtcNow, ErrorCode = 0, ErrorMessage = "There was a problem", Expression = "1" }; // Act _dataProvider.CreateValidation(validationEntity); ValidationEntity createdValidationEntity = (ValidationEntity)_dataProvider.GetValidation(validationEntity.ValidationID); createdValidationEntity.ErrorMessage = "There was another problem"; _dataProvider.UpdateValidation(createdValidationEntity); ValidationEntity updatedValidationEntity = (ValidationEntity)_dataProvider.GetValidation(createdValidationEntity.ValidationID); // Assert updatedValidationEntity.Should().BeEquivalentTo(createdValidationEntity); }
public IResponse GetValidation(int validationID) { GuardianOptions options = GuardianOptionsFactory.GetOptions(); GuardianDataProvider dataProvider = options.GuardianDataProviderFactory(); return(new JsonResponse(dataProvider.GetValidation(validationID))); }
public IResponse UpdateValidation(Validation validation) { GuardianOptions options = GuardianOptionsFactory.GetOptions(); GuardianDataProvider dataProvider = options.GuardianDataProviderFactory(); IValidation createdValidation = dataProvider.UpdateValidation(validation); return(new JsonResponse(dataProvider.GetValidation(createdValidation.ValidationID))); }