public void Remove(FieldSpecification value) { GmsecPINVOKE.FieldSpecificationList_Remove(swigCPtr, FieldSpecification.getCPtr(value)); if (GmsecPINVOKE.SWIGPendingException.Pending) { throw GmsecPINVOKE.SWIGPendingException.Retrieve(); } }
public void Insert(int index, FieldSpecification value) { GmsecPINVOKE.FieldSpecificationList_Insert(swigCPtr, index, FieldSpecification.getCPtr(value)); if (GmsecPINVOKE.SWIGPendingException.Pending) { throw GmsecPINVOKE.SWIGPendingException.Retrieve(); } }
public void IsSatisfiedByWithNullRequestShouldThrowArgumentNullException() { // Arrange var sut = new FieldSpecification(typeof(object), "someName"); // Act & assert Assert.Throws <ArgumentNullException>(() => sut.IsSatisfiedBy(null)); }
public void SutIsRequestSpecification() { // Arrange // Act var sut = new FieldSpecification(typeof(object), "someName"); // Assert Assert.IsAssignableFrom <IRequestSpecification>(sut); }
public int LastIndexOf(FieldSpecification value) { int ret = GmsecPINVOKE.FieldSpecificationList_LastIndexOf(swigCPtr, FieldSpecification.getCPtr(value)); if (GmsecPINVOKE.SWIGPendingException.Pending) { throw GmsecPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public void IsSatisfiedByWithNullRequestShouldThrowArgumentNullException() { // Fixture setup var sut = new FieldSpecification(typeof(object), "someName"); // Exercise system and verify outcome Assert.Throws <ArgumentNullException>(() => sut.IsSatisfiedBy(null)); // Teardown }
public void SutIsRequestSpecification() { // Fixture setup // Exercise system var sut = new FieldSpecification(typeof(object), "someName"); // Verify outcome Assert.IsAssignableFrom <IRequestSpecification>(sut); // Teardown }
public void IsSatisfiedByWithInvalidRequestShouldReturnFalse(object request) { // Arrange var sut = new FieldSpecification(typeof(object), "someName"); // Act var result = sut.IsSatisfiedBy(request); // Assert Assert.False(result); }
public bool Contains(FieldSpecification value) { bool ret = GmsecPINVOKE.FieldSpecificationList_Contains(swigCPtr, FieldSpecification.getCPtr(value)); if (GmsecPINVOKE.SWIGPendingException.Pending) { throw GmsecPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
private FieldSpecification getitem(int index) { global::System.IntPtr cPtr = GmsecPINVOKE.FieldSpecificationList_getitem(swigCPtr, index); FieldSpecification ret = (cPtr == global::System.IntPtr.Zero) ? null : new FieldSpecification(cPtr, false); if (GmsecPINVOKE.SWIGPendingException.Pending) { throw GmsecPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public void IsSatisfiedByWithInvalidRequestShouldReturnFalse(object request) { // Fixture setup var sut = new FieldSpecification(typeof(object), "someName"); // Exercise system var result = sut.IsSatisfiedBy(request); // Verify outcome Assert.False(result); // Teardown }
public void IsSatisfiedByWithRequestForFieldWithSameNameAndIncompatibleTypeShouldReturnFalse() { // Arrange var sut = new FieldSpecification(typeof(object), "Field"); var request = typeof(FieldHolder <string>).GetField("Field"); // Act var result = sut.IsSatisfiedBy(request); // Assert Assert.False(result); }
public static FieldSpecificationList Repeat(FieldSpecification value, int count) { global::System.IntPtr cPtr = GmsecPINVOKE.FieldSpecificationList_Repeat(FieldSpecification.getCPtr(value), count); FieldSpecificationList ret = (cPtr == global::System.IntPtr.Zero) ? null : new FieldSpecificationList(cPtr, true); if (GmsecPINVOKE.SWIGPendingException.Pending) { throw GmsecPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static void Deploy() { ITransaction deploymentTransaction = SQLProviderFactory.GenerateTransaction(); try { HashSet <string> schemas = Instance.schemaObjects.Select(schemaObject => schemaObject.SchemaName).ToHashSet(); foreach (string schema in schemas) { ICreateSchema createSchema = SQLProviderFactory.GetCreateSchemaQuery(); createSchema.SchemaName = schema; createSchema.Execute(deploymentTransaction); } foreach (SchemaObject schemaObject in Instance.schemaObjects) { ICreateTable createTable = SQLProviderFactory.GetCreateTableQuery(); createTable.SchemaName = schemaObject.SchemaName; createTable.TableName = schemaObject.ObjectName; foreach (Field field in schemaObject.GetFields()) { FieldSpecification fieldSpec = new FieldSpecification(field.FieldType, field.DataSize, field.DataScale); if (field == schemaObject.PrimaryKeyField) { fieldSpec.IsPrimary = true; } createTable.Columns.Add(field.FieldName, fieldSpec); } createTable.Execute(deploymentTransaction); } foreach (Relationship relationship in Instance.schemaObjects.SelectMany(so => so.GetRelationships())) { string fkName = $"FK{relationship.ParentSchemaObject.ObjectName}_{relationship.RelatedSchemaObject.ObjectName}_{relationship.ForeignKeyField.FieldName}"; IAlterTable alterTableQuery = SQLProviderFactory.GetAlterTableQuery(); alterTableQuery.Schema = relationship.ParentSchemaObject.SchemaName; alterTableQuery.Table = relationship.ParentSchemaObject.ObjectName; alterTableQuery.AddForeignKey(fkName, relationship.ForeignKeyField.FieldName, relationship.RelatedSchemaObject.SchemaName, relationship.RelatedSchemaObject.ObjectName, relationship.ParentKeyField.FieldName, deploymentTransaction); } deploymentTransaction.Commit(); } finally { if (deploymentTransaction.IsActive) { deploymentTransaction.Rollback(); } } }
public void IsSatisfiedByWithRequestForMemberOtherThanFieldWithSameNameShouldReturnFalse() { // Arrange var sut = new FieldSpecification(typeof(object), "Property"); var request = typeof(PropertyHolder <object>).GetProperty("Property"); // Act var result = sut.IsSatisfiedBy(request); // Assert Assert.False(result); }
public void IsSatisfiedByWithRequestForFieldWithSameNameAndIncompatibleTypeShouldReturnFalse() { // Fixture setup var sut = new FieldSpecification(typeof(object), "Field"); var request = typeof(FieldHolder <string>).GetField("Field"); // Exercise system var result = sut.IsSatisfiedBy(request); // Verify outcome Assert.False(result); // Teardown }
public void IsSatisfiedByWithRequestForMemberOtherThanFieldWithSameNameShouldReturnFalse() { // Fixture setup var sut = new FieldSpecification(typeof(object), "Property"); var request = typeof(PropertyHolder <object>).GetProperty("Property"); // Exercise system var result = sut.IsSatisfiedBy(request); // Verify outcome Assert.False(result); // Teardown }
public void InitializeWithFieldNameShouldSetCorrespondingProperty() { // Fixture setup var type = typeof(string); var name = "someName"; // Exercise system var sut = new FieldSpecification(type, name); // Verify outcome Assert.Equal(type, sut.TargetType); Assert.Equal(name, sut.TargetName); // Teardown }
public void InitializeWithFieldNameShouldSetCorrespondingProperty() { // Arrange var type = typeof(string); var name = "someName"; // Act var sut = new FieldSpecification(type, name); // Assert #pragma warning disable 618 Assert.Equal(type, sut.TargetType); Assert.Equal(name, sut.TargetName); #pragma warning restore 618 }
public void IsSatisfiedByWithRequestForFieldShouldReturnCorrectResult( string fieldName, string requestedName, bool expectedResult) { // Arrange var sut = new FieldSpecification(typeof(object), fieldName); var request = typeof(FieldHolder <object>).GetField(requestedName); // Act var result = sut.IsSatisfiedBy(request); // Assert Assert.Equal(expectedResult, result); }
internal override void PopulateSpecification(FieldSpecification spec, bool isPostBack) { var upload = new FileUpload(); upload.ID = "ui" + Id; upload.CssClass = spec.SpanClass; spec.AddControl(new LiteralControl("<div class=\"fileinputs\">")); spec.AddControl(GetLabel(upload)); spec.AddControl(new LiteralControl("</div>")); spec.AddControl(upload); if (Mandatory) spec.AddValidator(GetRequiredFieldValidator(upload)); spec.Get = () => upload; }
internal override void PopulateSpecification(FieldSpecification spec, bool isPostBack) { var label = new HtmlGenericControl("label"); label.Attributes.Add("class", "checkbox"); var checkbox = new CheckBox(); checkbox.ID = "ui" + Id; if (!isPostBack) checkbox.Checked = DefaultChecked; label.Controls.Add(checkbox); label.Controls.Add(new LiteralControl(Label)); spec.AddControl(label); spec.Get = () => checkbox.Checked; }
public void IsSatisfiedByWithRequestForFieldShouldReturnCorrectResult( string fieldName, string requestedName, bool expectedResult) { // Fixture setup var sut = new FieldSpecification(typeof(object), fieldName); var request = typeof(FieldHolder <object>).GetField(requestedName); // Exercise system var result = sut.IsSatisfiedBy(request); // Verify outcome Assert.Equal(expectedResult, result); // Teardown }
internal override void PopulateSpecification(FieldSpecification spec, bool isPostBack) { var textBox = new TextBox(); textBox.ID = "ui" + Id; textBox.CssClass = spec.SpanClass; if (MultiLine) textBox.TextMode = TextBoxMode.MultiLine; if (MaxLength.HasValue) textBox.MaxLength = MaxLength.Value; spec.AddControl(GetLabel(textBox)); spec.AddControl(textBox); if (Mandatory) spec.AddValidator(GetRequiredFieldValidator(textBox)); spec.Get = () => textBox.Text; }
public void IsSatisfiedByReturnsCorrectResultAccordingToTarget( bool expected) { var field = typeof(string).GetField("Empty"); var target = new DelegatingCriterion <FieldInfo> { OnEquals = f => { Assert.Equal(field, f); return(expected); } }; var sut = new FieldSpecification(target); var actual = sut.IsSatisfiedBy(field); Assert.Equal(expected, actual); }
internal override void PopulateSpecification(FieldSpecification spec, bool isPostBack) { var textBox = new TextBox(); textBox.ID = "ui" + Id; textBox.MaxLength = 150; textBox.CssClass = spec.SpanClass; spec.AddControl(GetLabel(textBox)); spec.AddControl(textBox); if (Mandatory) spec.AddValidator(GetRequiredFieldValidator(textBox)); var regularExpressionValidator = new RegularExpressionValidator(); regularExpressionValidator.ValidationExpression = @"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"; regularExpressionValidator.ControlToValidate = textBox.ID; regularExpressionValidator.ErrorMessage = InvalidEmailErrorMessage; spec.AddValidator(regularExpressionValidator); spec.Get = () => textBox.Text; }
internal override void PopulateSpecification(FieldSpecification spec, bool isPostBack) { var dropDownList = new DropDownList(); dropDownList.ID = "ui" + Id; dropDownList.Items.Add(new ListItem(string.Empty)); dropDownList.CssClass = spec.SpanClass; foreach (var value in Values) dropDownList.Items.Add(value); spec.AddControl(GetLabel(dropDownList)); spec.AddControl(dropDownList); if (Mandatory) { var validator = GetRequiredFieldValidator(dropDownList); validator.InitialValue = dropDownList.Items[0].Value; spec.AddValidator(validator); } spec.Get = () => dropDownList.SelectedValue; }
public DatValue(FieldSpecification fieldData, object fieldValue, DatFileIndex datIndex) { Specification = fieldData; var idx = datIndex; if (!string.IsNullOrEmpty(fieldData.Key)) { if (fieldValue is List <object> l) { _fieldValue = new Lazy <object>(() => l .Select(p => NullValues.Contains(p) ? null : idx[fieldData.Key][Convert.ToInt32(p)]) .ToList()); } else if (fieldValue is ulong || fieldValue is int || fieldValue is uint) { _fieldValue = NullValues.Contains(fieldValue) ? new Lazy <object>(() => null) : new Lazy <object>(() => idx[fieldData.Key][Convert.ToInt32(fieldValue)]); } else { if (NullValues.Contains(fieldValue)) { _fieldValue = new Lazy <object>(() => null); } else { throw new Exception("Unexpected data type in conjunction with a Key field"); } } } else { _fieldValue = NullValues.Contains(fieldValue) ? new Lazy <object>(() => null) : new Lazy <object>(() => fieldValue); } }
private static Specification <T> CreateExpression <T>(FilterDefinition filterdata, FilterMetadata metadata) { Specification <T> spec = null; if (filterdata is SimpleFilterDefinition) { var data = filterdata as SimpleFilterDefinition; spec = new FieldSpecification <T>(data, metadata.GetTypeCodeOfField(data.FieldName)); } else if (filterdata is ComplexFilterDefinition) { var data = filterdata as ComplexFilterDefinition; if (data.FiltersConnector == ComplexFilterDefinition.Connector.And) { spec = new AndSpecification <T>(CreateExpression <T>(data.LeftFilter, metadata), CreateExpression <T>(data.RightFilter, metadata)); } else { spec = new OrSpecification <T>(CreateExpression <T>(data.LeftFilter, metadata), CreateExpression <T>(data.RightFilter, metadata)); } } return(spec); }
public QaSchemaFieldProperties( [Doc(nameof(DocStrings.QaSchemaFieldProperties_table))][NotNull] ITable table, [Doc(nameof(DocStrings.QaSchemaFieldProperties_fieldName))][NotNull] string fieldName, [Doc(nameof(DocStrings.QaSchemaFieldProperties_expectedFieldType))] esriFieldType expectedFieldType, [Doc(nameof(DocStrings.QaSchemaFieldProperties_expectedFieldLength))] int expectedFieldLength, [Doc(nameof(DocStrings.QaSchemaFieldProperties_expectedAliasName))][CanBeNull] string expectedAliasName, [Doc(nameof(DocStrings.QaSchemaFieldProperties_expectedDomainName))][CanBeNull] string expectedDomainName, [Doc(nameof(DocStrings.QaSchemaFieldProperties_fieldIsOptional))] bool fieldIsOptional) : base(table, false) { _fieldSpecification = new FieldSpecification(fieldName, expectedFieldType, expectedFieldLength, expectedAliasName, expectedDomainName, fieldIsOptional); }
internal virtual void PopulateSpecification(FieldSpecification spec, bool isPostBack) { }