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 InterfaceAccessor() { InterfaceAccessor inter = new InterfaceAccessor(controller); inter.Name = "File"; Assert.That(inter.IsTheSame(inter.Clone(), ComparisonDepth.Outer), Is.True); }
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 VBInterfaceAccessorPrinter(InterfaceAccessor obj) { this.obj = obj; }
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); }
public VBInterfaceProperty(VBController controller, VBBaseConstruct parentObject, string name, DataType dataType, InterfaceAccessor getAccessor, InterfaceAccessor setAccessor, bool hasNewKeyword, CodeLanguage language, int nodeIndex) : base(controller, parentObject, name, dataType, getAccessor, setAccessor, hasNewKeyword, language, nodeIndex) { }
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;"); }