public void InterfaceProperty() { InterfaceProperty inter = new InterfaceProperty(controller, "InterfaceProperty1"); inter.Name = "File"; inter.DataType = new DataType(controller, "int"); InterfaceAccessor acc = new InterfaceAccessor(controller); acc.AccessorType = InterfaceAccessor.AccessorTypes.Get; inter.AddChild(acc); acc = new InterfaceAccessor(controller); acc.AccessorType = InterfaceAccessor.AccessorTypes.Set; inter.AddChild(acc); CodeRoot root = CreateNamespaceAndInterface(inter); CodeRootMap map = new CodeRootMap(); map.AddCodeRoot(root, Version.User); map.AddCodeRoot(root, Version.NewGen); map.AddCodeRoot(root, Version.PrevGen); string result = map.GetMergedCodeRoot().ToString(); Assert.That(result, Is.EqualTo(root.ToString())); Assertions.StringContains(result, "public interface Interface1"); Assertions.StringContains(result, "[Serializable(true)]"); Assertions.StringContains(result, "namespace ArchAngel.Tests"); Assertions.StringContains(result, "int File"); Assertions.StringContains(result, "get;"); Assertions.StringContains(result, "set;"); }
public void InterfacePropertyGetFeature() { var p = new InterfaceProperty(new TypeName("String"), "DisplayName", true, false); Assert.AreEqual("String DisplayName { get; }" + SourceCodeGenerator.NewLine , SourceCodeGenerator.Write(SourceCodeLanguage.CSharp, p)); }
public InterfacePropertyView(InterfaceProperty property, InterfaceData owner) { this.owner = owner; this.property = property; title = $"{property.name} : {property.returnType.DisplayName(false, false)}"; titleIcon.image = uNodeEditorUtility.GetTypeIcon(typeof(TypeIcons.PropertyIcon)); expandedElement.visible = false; }
public void InterfaceProperty() { InterfaceProperty inter = new InterfaceProperty(controller, "File"); inter.DataType = new DataType(controller, "int"); inter.HasNewKeyword = true; Assert.That(inter.IsTheSame(inter.Clone(), ComparisonDepth.Outer), Is.True); }
/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (SessionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "SessionId"); } if (InterfaceProperty != null) { InterfaceProperty.Validate(); } }
internal static NICInterface[] Parse(string theIfConfigResult) { string[] Lines = theIfConfigResult.Split(new string[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries); List <NICInterface> NICInterfaceList = new List <NICInterface>(); NICInterface CurrentNICInterface = null; foreach (string line in Lines) { if (!line.StartsWith(" ")) { if (CurrentNICInterface != null) { NICInterfaceList.Add(CurrentNICInterface); } CurrentNICInterface = new NICInterface(); CurrentNICInterface.Name = line.Split(':').First(); } else { string TrimmedLine = line.Trim(); if (TrimmedLine.StartsWith("inet ")) { string[] InterfaceProperties = TrimmedLine.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); foreach (string InterfaceProperty in InterfaceProperties) { if (InterfaceProperty.StartsWith("inet")) { CurrentNICInterface.Inet = InterfaceProperty.Split(' ').Last(); } else if (InterfaceProperty.StartsWith("netmask")) { CurrentNICInterface.Netmask = InterfaceProperty.Split(' ').Last(); } else if (InterfaceProperty.StartsWith("broadcast")) { CurrentNICInterface.Broadcast = InterfaceProperty.Split(' ').Last(); } } } } } if (CurrentNICInterface != null) { NICInterfaceList.Add(CurrentNICInterface); } return(NICInterfaceList.ToArray()); }
public ReadOnlyInterfaceProperty(InterfaceProperty interfaceProperty) { this.interfaceProperty = interfaceProperty; propertyType = new ReadOnlyTypeReference(interfaceProperty.Type); if (interfaceProperty.GetAccessor != null) { getAccessor = new ReadOnlyInterfaceAccessor(); } if (interfaceProperty.SetAccessor != null) { setAccessor = new ReadOnlyInterfaceAccessor(); } }
public void InterfaceProperty() { Interface it = new Interface(controller, "Interface1"); InterfaceProperty item = new InterfaceProperty(controller, "Property1", new DataType(controller, "int")); Assert.That(item.FullyQualifiedDisplayName, Is.EqualTo("Property1")); it.AddChild(item); Namespace ns = new Namespace(controller); ns.Name = "ns1"; ns.AddChild(it); Assert.That(item.FullyQualifiedDisplayName, Is.EqualTo("ns1.Interface1.Property1")); }
public void An_InterfaceProperty_Is_Created() { const string code = "int Property1 { get; set; }"; CSharpParser parser = new CSharpParser(); IBaseConstruct bc = parser.ParseSingleConstruct(code, BaseConstructType.InterfacePropertyDeclaration); Assert.That(bc, Is.Not.Null); Assert.That(bc, Is.InstanceOfType(typeof(InterfaceProperty))); InterfaceProperty con = (InterfaceProperty)bc; Assert.That(con.Name, Is.EqualTo("Property1")); Assert.That(con.DataType.Name, Is.EqualTo("int")); Assert.That(con.GetAccessor, Is.Not.Null); Assert.That(con.SetAccessor, Is.Not.Null); }
public void InterfaceBasicFeature() { var c = new Interface("IPerson"); var p = new InterfaceProperty("Int32", "Age", true, true); c.Properties.Add(p); var md = new InterfaceMethod("GetNumber"); c.Methods.Add(md); Assert.AreEqual("public interface IPerson" + SourceCodeGenerator.NewLine + "{" + SourceCodeGenerator.NewLine + " Int32 Age { get; set; }" + SourceCodeGenerator.NewLine + SourceCodeGenerator.NewLine + " void GetNumber();" + SourceCodeGenerator.NewLine + "}" + SourceCodeGenerator.NewLine , SourceCodeGenerator.Write(SourceCodeLanguage.CSharp, c)); }
public void InterfaceAccessor() { InterfaceProperty itp = new InterfaceProperty(controller, "Property1", new DataType(controller, "int")); InterfaceAccessor item1 = new InterfaceAccessor(controller, ArchAngel.Providers.CodeProvider.DotNet.InterfaceAccessor.AccessorTypes.Get, ""); InterfaceAccessor item2 = new InterfaceAccessor(controller, ArchAngel.Providers.CodeProvider.DotNet.InterfaceAccessor.AccessorTypes.Set, ""); itp.AddChild(item1); itp.AddChild(item2); Assert.That(item1.FullyQualifiedDisplayName, Is.EqualTo("Property1.Get Accessor")); Assert.That(item2.FullyQualifiedDisplayName, Is.EqualTo("Property1.Set Accessor")); Interface it = new Interface(controller, "Interface1"); it.AddChild(itp); Namespace ns = new Namespace(controller); ns.Name = "ns1"; ns.AddChild(it); Assert.That(item1.FullyQualifiedDisplayName, Is.EqualTo("ns1.Interface1.Property1.Get Accessor")); Assert.That(item2.FullyQualifiedDisplayName, Is.EqualTo("ns1.Interface1.Property1.Set Accessor")); }
public void Interface_Properties() { const string code = @" public interface Interface1 { string Property1 { get; set; } } "; CSharpParser parser = new CSharpParser(); parser.ParseCode(code); ICodeRoot codeRoot = parser.CreatedCodeRoot; Interface clazz = (Interface)codeRoot.WalkChildren()[0]; InterfaceProperty inter = (InterfaceProperty)clazz.WalkChildren()[0]; Assert.That(inter.Name, Is.EqualTo("Property1")); Assert.That(inter.DataType.ToString(), Is.EqualTo("string")); Assert.That(inter.GetAccessor, Is.Not.Null); Assert.That(inter.SetAccessor, Is.Not.Null); }
public void InterfaceAccessor_Change_Modifier() { InterfaceAccessor merged1 = new InterfaceAccessor(controller); InterfaceAccessor merged2 = new InterfaceAccessor(controller); InterfaceAccessor merged3 = new InterfaceAccessor(controller); const string name = "MyName1"; InterfaceProperty property1 = new InterfaceProperty(controller, name, new DataType(controller, DataType2)); InterfaceProperty property2 = new InterfaceProperty(controller, name, new DataType(controller, DataType2)); string expectedResult = String.Format("{0} get;", Modifier2); InterfaceAccessor changing = new InterfaceAccessor(controller, InterfaceAccessor.AccessorTypes.Get, Modifier2); InterfaceAccessor unchanging = new InterfaceAccessor(controller, InterfaceAccessor.AccessorTypes.Get, Modifier1); property1.AddChild(changing); property2.AddChild(unchanging); Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult); }
protected bool Equals(InterfaceProperty other) { return(base.Equals(other) && this.property.Equals(other.property) && this.reflectedType.Equals(other.reflectedType)); }
public static int GetProgramInterfaceiv(int program, ProgramInterface intr, InterfaceProperty pname) { unsafe { int result = 0; glGetProgramInterfaceiv(program, intr, pname, &result); return result; } }
public void InterfaceProperty() { InterfaceProperty inter = new InterfaceProperty(controller,"InterfaceProperty1"); inter.Name = "File"; inter.DataType = new DataType(controller,"int"); InterfaceAccessor acc = new InterfaceAccessor(controller); acc.AccessorType = InterfaceAccessor.AccessorTypes.Get; inter.AddChild(acc); acc = new InterfaceAccessor(controller); acc.AccessorType = InterfaceAccessor.AccessorTypes.Set; inter.AddChild(acc); CodeRoot root = CreateNamespaceAndInterface(inter); CodeRootMap map = new CodeRootMap(); map.AddCodeRoot(root, Version.User); map.AddCodeRoot(root, Version.NewGen); map.AddCodeRoot(root, Version.PrevGen); string result = map.GetMergedCodeRoot().ToString(); Assert.That(result, Is.EqualTo(root.ToString())); Assertions.StringContains(result, "public interface Interface1"); Assertions.StringContains(result, "[Serializable(true)]"); Assertions.StringContains(result, "namespace ArchAngel.Tests"); Assertions.StringContains(result, "int File"); Assertions.StringContains(result, "get;"); Assertions.StringContains(result, "set;"); }
public VBInterfacePropertyPrinter(InterfaceProperty obj) { this.obj = obj; }
public void InterfaceProperty_Change_DataType() { const string name = "MyInterfaceProperty1"; DataType type1 = new DataType(controller, DataType1); DataType type2 = new DataType(controller, DataType2); const string expectedResult = DataType2 + " " + name; InterfaceProperty merged1 = new InterfaceProperty(controller, name); InterfaceProperty merged2 = new InterfaceProperty(controller, name); InterfaceProperty merged3 = new InterfaceProperty(controller, name); InterfaceProperty unchanging = new InterfaceProperty(controller, name, type1); InterfaceProperty changing = new InterfaceProperty(controller, name, type2); Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult); }
public void InterfaceProperty_Add_HasNewKeyword() { const string name = "InterfaceProperty1"; DataType type = new DataType(controller, DataType1); const string expectedResult = "new " + DataType1 + " " + name; InterfaceProperty merged1 = new InterfaceProperty(controller,name); InterfaceProperty merged2 = new InterfaceProperty(controller, name); InterfaceProperty merged3 = new InterfaceProperty(controller, name); InterfaceProperty unchanging = new InterfaceProperty(controller, name, type); InterfaceProperty changing = new InterfaceProperty(controller, name, type); changing.HasNewKeyword = true; Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult); }
private void Process_Interace_Property_Declaration(InterfacePropertyDeclaration node) { if (node == null) throw new ArgumentNullException("node"); if (node.IsIndexer) { InterfaceIndexer inter = new InterfaceIndexer(controller); inter.DataType = FormatterUtility.GetDataTypeFromTypeReference(node.ReturnType, document, controller); foreach (ParameterDeclaration paramNode in node.Parameters) { inter.Parameters.Add(GetParameterFromParameterDeclaration(document, controller, paramNode)); } SetupBaseConstruct(node, inter); } else { InterfaceProperty inter = new InterfaceProperty(controller, node.Name.Text); inter.DataType = FormatterUtility.GetDataTypeFromTypeReference(node.ReturnType, document, controller); SetupBaseConstruct(node, inter); } }
private static unsafe extern void glGetProgramInterfaceiv(int program, ProgramInterface intr, InterfaceProperty pname, int* parameters);
public void InterfaceProperty() { InterfaceProperty inter = new InterfaceProperty(controller, "File"); inter.DataType = new DataType(controller,"int"); inter.HasNewKeyword = true; Assert.That(inter.IsTheSame(inter.Clone(), ComparisonDepth.Outer), Is.True); }