Ejemplo n.º 1
0
        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 CreateValidation(Validation validation)
        {
            GuardianOptions      options      = GuardianOptionsFactory.GetOptions();
            GuardianDataProvider dataProvider = options.GuardianDataProviderFactory();

            IValidation createdValidation = dataProvider.CreateValidation(validation);

            return(new JsonResponse(dataProvider.GetValidation(createdValidation.ValidationID)));
        }