Exemplo n.º 1
0
        public void Create_Get_Update_ValidationCondition_Succeeds()
        {
            // Arrange
            ValidationConditionEntity validationConditionEntity = new ValidationConditionEntity
            {
                ActiveFlag         = true,
                ApplicationID      = "Guardian",
                DateCreatedOffset  = DateTimeOffset.UtcNow,
                DateModifiedOffset = DateTimeOffset.UtcNow,
                Expression         = "1"
            };

            // Act
            _dataProvider.CreateValidationCondition(validationConditionEntity);

            ValidationConditionEntity createdValidationConditionEntity =
                (ValidationConditionEntity)_dataProvider.GetValidationCondition(validationConditionEntity.ValidationConditionID);

            createdValidationConditionEntity.Expression = "2";

            _dataProvider.UpdateValidationCondition(createdValidationConditionEntity);

            ValidationConditionEntity updatedValidationConditionEntity =
                (ValidationConditionEntity)_dataProvider.GetValidationCondition(createdValidationConditionEntity.ValidationConditionID);

            // Assert
            updatedValidationConditionEntity.Should().Be(createdValidationConditionEntity);
        }
Exemplo n.º 2
0
        public IResponse GetValidationCondition(int validationConditionID)
        {
            GuardianOptions      options      = GuardianOptionsFactory.GetOptions();
            GuardianDataProvider dataProvider = options.GuardianDataProviderFactory();

            return(new JsonResponse(dataProvider.GetValidationCondition(validationConditionID)));
        }
Exemplo n.º 3
0
        public IResponse UpdateValidationCondition(ValidationCondition validationCondition)
        {
            GuardianOptions      options      = GuardianOptionsFactory.GetOptions();
            GuardianDataProvider dataProvider = options.GuardianDataProviderFactory();

            IValidationCondition createdValidation = dataProvider.UpdateValidationCondition(validationCondition);

            return(new JsonResponse(dataProvider.GetValidationCondition(createdValidation.ValidationConditionID)));
        }