private Interface(Interface interfaceToCopyFrom) : base(null) { interfaceToCopyFrom.CloneInto(this); InterfaceBase = interfaceToCopyFrom.InterfaceBase; foreach(string mod in interfaceToCopyFrom.Modifiers) { _Modifiers.Add(mod); } }
public void Interface_Added_InterfaceBase() { const string name = "MyInterface1"; const string baseName = "InterfaceBase1"; string expectedResult = String.Format("interface {0} : {1}", name, baseName); Interface merged1 = new Interface(controller, name); Interface merged2 = new Interface(controller, name); Interface merged3 = new Interface(controller, name); Interface changing = new Interface(controller, name); Interface unchanging = new Interface(controller, name); changing.InterfaceBase = baseName; Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult); }
public void Interface_Changed_Modifier() { const string name = "MyInterface1"; string expectedResult = String.Format("{0} interface {1}", Modifier2, name); Interface merged1 = new Interface(controller, name); Interface merged2 = new Interface(controller, name); Interface merged3 = new Interface(controller, name); Interface changing = new Interface(controller, name, Modifier1); Interface unchanging = new Interface(controller, name, Modifier1); changing.Modifiers[0] = Modifier2; Merge_And_Assert(merged1, merged2, merged3, changing, unchanging, expectedResult); }
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 InterfaceMethod() { Interface it = new Interface(controller, "Interface1"); InterfaceMethod item = new InterfaceMethod(controller, "Function1", new DataType(controller, "int")); item.Parameters.Add(new Parameter(controller, "float", "f")); item.Parameters.Add(new Parameter(controller, "InputObject", "j")); Assert.That(item.FullyQualifiedDisplayName, Is.EqualTo("Function1 (float, InputObject)")); it.AddChild(item); Namespace ns = new Namespace(controller); ns.Name = "ns1"; ns.AddChild(it); Assert.That(item.FullyQualifiedDisplayName, Is.EqualTo("ns1.Interface1.Function1 (float, InputObject)")); }
public void InterfaceIndexer() { Interface it = new Interface(controller, "Interface1"); InterfaceIndexer item = new InterfaceIndexer(controller, new DataType(controller, "int"), false); item.Parameters.Add(new Parameter(controller, "float", "f")); item.Parameters.Add(new Parameter(controller, "InputObject", "j")); Assert.That(item.FullyQualifiedDisplayName, Is.EqualTo("Indexer [float, InputObject]")); it.AddChild(item); Namespace ns = new Namespace(controller); ns.Name = "ns1"; ns.AddChild(it); Assert.That(item.FullyQualifiedDisplayName, Is.EqualTo("ns1.Interface1.Indexer [float, InputObject]")); }
public void InterfaceEvent() { Interface it = new Interface(controller, "Interface1"); InterfaceEvent item = new InterfaceEvent(controller, "Event1", new DataType(controller, "Delegate1"), false); Assert.That(item.FullyQualifiedDisplayName, Is.EqualTo("Event1")); it.AddChild(item); Namespace ns = new Namespace(controller); ns.Name = "ns1"; ns.AddChild(it); Assert.That(item.FullyQualifiedDisplayName, Is.EqualTo("ns1.Interface1.Event1")); }
public void Interface() { Interface inter = new Interface(controller, "Interface1"); inter.Modifiers.Add("public"); Class cl = new Class(controller, "Class1"); cl.AddChild(inter); AttributeSection attrs = new AttributeSection(controller); Attribute attr = new Attribute(controller); attr.PositionalArguments.Add("true"); attr.Name = "Serializable"; attrs.AddAttribute(attr); cl.AddAttributeSection(attrs); Namespace ns = new Namespace(controller); ns.Name = "ArchAngel.Tests"; ns.AddChild(cl); CodeRoot root = new CodeRoot(controller); root.AddChild(ns); 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, "class Class1"); Assertions.StringContains(result, "[Serializable(true)]"); Assertions.StringContains(result, "namespace ArchAngel.Tests"); Assertions.StringContains(result, "public interface Interface1"); }
public void Interface() { Interface item = new Interface(controller, "Interface1"); Assert.That(item.FullyQualifiedDisplayName, Is.EqualTo("Interface1")); Namespace ns = new Namespace(controller); ns.Name = "ns1"; ns.AddChild(item); Assert.That(item.FullyQualifiedDisplayName, Is.EqualTo("ns1.Interface1")); }
public void Interface() { Interface inter = new Interface(controller, "Interface1"); inter.Modifiers.Add("public"); Assert.That(inter.IsTheSame(inter.Clone(), ComparisonDepth.Outer), Is.True); }
private bool IsTheSame(Interface comparisonInterface, ComparisonDepth depth) { if (comparisonInterface == null) return false; if (Name == comparisonInterface.Name) { if (depth == ComparisonDepth.Signature) { return true; } if (!base.IsTheSame(comparisonInterface, depth)) { return false; } if (!Utility.StringCollectionsAreTheSame(Modifiers, comparisonInterface.Modifiers)) { ComparisonDifference += GetType().Name + ".Modifiers"; return false; } if (depth == ComparisonDepth.Outer) { return true; } // Now check all child objects Comparers.BaseConstructComparer comparer = new Comparers.BaseConstructComparer(); if (!ArchAngel.Providers.CodeProvider.CSharp.Utility.BaseContructCollectionsAreTheSame(Events.ToArray(), comparisonInterface.Events.ToArray(), comparer)) { ComparisonDifference += GetType().Name + ".Events"; return false; } if (!ArchAngel.Providers.CodeProvider.CSharp.Utility.BaseContructCollectionsAreTheSame(Indexers.ToArray(), comparisonInterface.Indexers.ToArray(), comparer)) { ComparisonDifference += GetType().Name + ".Indexers"; return false; } if (!ArchAngel.Providers.CodeProvider.CSharp.Utility.BaseContructCollectionsAreTheSame(Methods.ToArray(), comparisonInterface.Methods.ToArray(), comparer)) { ComparisonDifference += GetType().Name + ".Methods"; return false; } if (!ArchAngel.Providers.CodeProvider.CSharp.Utility.BaseContructCollectionsAreTheSame(Properties.ToArray(), comparisonInterface.Properties.ToArray(), comparer)) { ComparisonDifference += GetType().Name + ".Properties"; return false; } return true; } return false; }
private bool IsTheSame(Interface comparisonFunction) { return IsTheSame(comparisonFunction, ComparisonDepth.Signature); }
private void Process_Interface_Declaration(TypeMemberDeclaration node) { if (node == null) throw new ArgumentNullException("node"); Interface inter = new Interface(controller, node.Name.Text); inter.Modifiers.AddRange(FormatterUtility.GetModifiersFromEnum(node.Modifiers)); SetupBaseConstruct(node, inter); }
private Interface Construct(Class @class) { Interface i = new Interface(@class.Controller, _value); return i; }
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 VBInterfacePrinter(Interface obj) { this.obj = obj; }
protected CodeRoot CreateNamespaceAndInterface(IBaseConstruct inter) { Interface interface1 = new Interface(controller, "Interface1"); interface1.Modifiers.Add("public"); interface1.AddChild(inter); AttributeSection attrs = new AttributeSection(controller); Attribute attr = new Attribute(controller); attr.PositionalArguments.Add("true"); attr.Name = "Serializable"; attrs.AddAttribute(attr); interface1.AddAttributeSection(attrs); Namespace ns = new Namespace(controller); ns.Name = "ArchAngel.Tests"; ns.AddChild(interface1); CodeRoot root = new CodeRoot(controller); root.AddChild(ns); return root; }