コード例 #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);
        }
コード例 #2
0
        public IResponse GetValidation(int validationID)
        {
            GuardianOptions      options      = GuardianOptionsFactory.GetOptions();
            GuardianDataProvider dataProvider = options.GuardianDataProviderFactory();

            return(new JsonResponse(dataProvider.GetValidation(validationID)));
        }
コード例 #3
0
        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)));
        }