public void DotNetQualifiedName_Clone_NullFullNamespace() { //arrange DotNetQualifiedName a = DotNetQualifiedName.FromVisualStudioXml("System"); //act DotNetQualifiedName result = a.Clone(); //assert Assert.AreEqual(a, result); }
public void DotNetQualifiedName_Clone_ManySegments() { //arrange DotNetQualifiedName a = DotNetQualifiedName.FromVisualStudioXml("System.Collections.Generic.List"); //act DotNetQualifiedName result = a.Clone(); //assert Assert.AreEqual(a, result); }
public void DotNetQualifiedName_IsWithin_GrandChild() { //arrange DotNetQualifiedName a = DotNetQualifiedName.FromVisualStudioXml("System"); DotNetQualifiedName b = DotNetQualifiedName.FromVisualStudioXml("System.Text.RegularExpressions"); //act bool result = b.IsWithin(a); //assert Assert.AreEqual(true, result); }
public void DotNetQualifiedName_CompareTo_DifferentDepths_ALongerThanB() { //arrange DotNetQualifiedName a = DotNetQualifiedName.FromVisualStudioXml("System.Collections.Generic"); DotNetQualifiedName b = DotNetQualifiedName.FromVisualStudioXml("System.Collections"); //act int result = a.CompareTo(b); //assert Assert.AreEqual(1, result); }
public void DotNetQualifiedName_IsWithin_Different() { //arrange DotNetQualifiedName a = DotNetQualifiedName.FromVisualStudioXml("System.Collections"); DotNetQualifiedName b = DotNetQualifiedName.FromVisualStudioXml("System.Text.RegularExpressions"); //act bool result = b.IsWithin(a); //assert Assert.AreEqual(false, result); }
public void DotNetQualifiedName_FromXml_Equality_Same() { //arrange DotNetQualifiedName a = DotNetQualifiedName.FromVisualStudioXml("A.B.C"); DotNetQualifiedName b = DotNetQualifiedName.FromVisualStudioXml("A.B.C"); //act bool result = (a == b); //assert Assert.AreEqual(true, result); }
public void DotNetQualifiedName_FromXml_Equality_OneNamespaceNull() { //arrange DotNetQualifiedName a = DotNetQualifiedName.FromVisualStudioXml("F"); DotNetQualifiedName b = DotNetQualifiedName.FromVisualStudioXml("D.E.F"); //act bool result = (a == b); //assert Assert.AreEqual(false, result); }
public void DotNetQualifiedName_FromXml_Equality_Different() { //arrange DotNetQualifiedName a = DotNetQualifiedName.FromVisualStudioXml("A.B.C"); DotNetQualifiedName b = DotNetQualifiedName.FromVisualStudioXml("D.E.F"); //act bool result = (a == b); //assert Assert.AreEqual(false, result); }
public void DotNetQualifiedName_Clone_ExplicitInterface() { //arrange DotNetQualifiedName a = DotNetQualifiedName.FromVisualStudioXml("System.Collections.Generic.A#B#C#List"); //act DotNetQualifiedName result = a.Clone(); //assert Assert.AreEqual(a, result); Assert.AreEqual("A.B.C", result.ExplicitInterface.ToString()); }
public void DotNetQualifiedName_CompareTo_SameDepths_DifferentExplicitInterfaces() { //arrange DotNetQualifiedName a1 = DotNetQualifiedName.FromVisualStudioXml("System.Collections#I1#A"); DotNetQualifiedName a2 = DotNetQualifiedName.FromVisualStudioXml("System.Collections#I2#A"); //act int result = a1.CompareTo(a2); //assert Assert.AreNotEqual(0, result); }
public void DotNetQualifiedName_CompareTo_SameDepths_AGreaterThanB() { //arrange DotNetQualifiedName a = DotNetQualifiedName.FromVisualStudioXml("System.Collections.C"); DotNetQualifiedName b = DotNetQualifiedName.FromVisualStudioXml("System.Collections.B"); //act int result = a.CompareTo(b); //assert Assert.AreEqual(1, result); }
public void DotNetQualifiedMethodName_FromXml_ClassGenericParameters_TwoGeneric() { //arrange string xmlFormatName = "M:DataFilesTest.DotNetQualifiedMethodNameTests.TwoGenericClass`2.MethodEmpty"; string expectedFullName = "DataFilesTest.DotNetQualifiedMethodNameTests.TwoGenericClass<T,U>.MethodEmpty"; Type type = typeof(TwoGenericClass <,>); //act DotNetQualifiedMethodName result = DotNetQualifiedName.FromVisualStudioXml(xmlFormatName) as DotNetQualifiedMethodName; //assert Assert.AreEqual(expectedFullName, result.FullName); }
public void DotNetQualifiedMethodName_FromXml_MethodGenericParameters_OneGeneric() { //arrange string xmlFormatName = "M:DataFilesTest.DotNetQualifiedMethodNameTests.OneGenericClass`1.MethodOne``1(``0)"; string expectedFullName = "DataFilesTest.DotNetQualifiedMethodNameTests.OneGenericClass<T>.MethodOne<A>"; Type type = typeof(OneGenericClass <>); //act DotNetQualifiedMethodName result = DotNetQualifiedName.FromVisualStudioXml(xmlFormatName) as DotNetQualifiedMethodName; //assert Assert.AreEqual(expectedFullName, result.FullName); }
public void DotNetQualifiedMethodName_FromAssembly_ClassGenericParameters_OneGeneric() { //arrange string xmlFormatName = "M:DataFilesTest.DotNetQualifiedMethodNameTests.OneGenericClass`1.MethodEmpty"; string expectedFullName = "DataFilesTest.DotNetQualifiedMethodNameTests.OneGenericClass<CustomT>.MethodEmpty"; Type type = typeof(OneGenericClass <>); MethodInfo methodInfo = type.GetMethods()[0]; //act DotNetQualifiedMethodName result = DotNetQualifiedName.FromVisualStudioXml(xmlFormatName) as DotNetQualifiedMethodName; result.AddAssemblyInfo(methodInfo); //assert Assert.AreEqual(expectedFullName, result.FullName); }
public void DotNetQualifiedMethodName_FromAssembly_MethodGenericParameters_TwoGeneric() { //arrange string xmlFormatName = "M:DataFilesTest.DotNetQualifiedMethodNameTests.TwoGenericClass`2.MethodTwo``2(``0,``1)"; string expectedFullName = "DataFilesTest.DotNetQualifiedMethodNameTests.TwoGenericClass<CustomT,CustomU>.MethodTwo<CustomA,CustomB>"; Type type = typeof(TwoGenericClass <,>); MethodInfo methodInfo = type.GetMethods()[1]; //act DotNetQualifiedMethodName result = DotNetQualifiedName.FromVisualStudioXml(xmlFormatName) as DotNetQualifiedMethodName; result.AddAssemblyInfo(methodInfo); //assert Assert.AreEqual(expectedFullName, result.FullName); }
public void DotNetQualifiedName_FromXml_MethodName_SimpleOneParameter() { //arrange string input = "M:A.B.MyType.MyMethod(System.String)"; string expectedLocalName = "MyMethod"; string expectedQualifiedName = "A.B.MyType.MyMethod"; string expectedFullNamespace = "A.B.MyType"; //act DotNetQualifiedName result = DotNetQualifiedName.FromVisualStudioXml(input); //assert Assert.AreEqual(expectedLocalName, result.LocalName); Assert.AreEqual(expectedQualifiedName, result.FullName); Assert.AreEqual(expectedFullNamespace, result.FullNamespace); }
public void DotNetQualifiedName_FromXml_TypeName_NestedInOneGeneric() { //arrange string input = "T:A.B.MyType`1.MyNestedType"; string expectedLocalName = "MyNestedType"; string expectedQualifiedName = "A.B.MyType<T>.MyNestedType"; string expectedFullNamespace = "A.B.MyType<T>"; //act DotNetQualifiedName result = DotNetQualifiedName.FromVisualStudioXml(input); //assert Assert.AreEqual(expectedLocalName, result.LocalName); Assert.AreEqual(expectedQualifiedName, result.FullName); Assert.AreEqual(expectedFullNamespace, result.FullNamespace); }
public void DotNetQualifiedName_Localize_ExactMatch() { //arrange DotNetQualifiedName a = DotNetQualifiedName.FromVisualStudioXml("A.B.C.D"); DotNetQualifiedName b = DotNetQualifiedName.FromVisualStudioXml("A.B.C.D"); //act a.Localize(b); DotNetQualifiedName c = a.GetLocalized(b); //assert Assert.IsFalse(Object.ReferenceEquals(a, c)); Assert.AreEqual(a, c); Assert.AreEqual("D", a); }
public void DotNetQualifiedName_FromXml_MethodName_TwoGenerics() { //arrange string input = "M:A.B.MyType.MyMethod``2"; string expectedLocalName = "MyMethod<A,B>"; string expectedQualifiedName = "A.B.MyType.MyMethod<A,B>"; string expectedFullNamespace = "A.B.MyType"; //act DotNetQualifiedName result = DotNetQualifiedName.FromVisualStudioXml(input); //assert Assert.AreEqual(expectedLocalName, result.LocalName); Assert.AreEqual(expectedQualifiedName, result.FullName); Assert.AreEqual(expectedFullNamespace, result.FullNamespace); }
public void DotNetQualifiedName_FromXml_EventName_Simple() { //arrange string input = "E:A.B.MyType.MyEvent"; string expectedLocalName = "MyEvent"; string expectedQualifiedName = "A.B.MyType.MyEvent"; string expectedFullNamespace = "A.B.MyType"; //act DotNetQualifiedName result = DotNetQualifiedName.FromVisualStudioXml(input); //assert Assert.AreEqual(expectedLocalName, result.LocalName); Assert.AreEqual(expectedQualifiedName, result.FullName); Assert.AreEqual(expectedFullNamespace, result.FullNamespace); }
public void DotNetQualifiedName_Localize_ExplicitInterface() { //arrange DotNetQualifiedName a = DotNetQualifiedName.FromVisualStudioXml("A.B.C.InterfaceNamespace#Interface#D"); DotNetQualifiedName b = DotNetQualifiedName.FromVisualStudioXml("A.B.C.D"); //act a.Localize(b); DotNetQualifiedName c = a.GetLocalized(b); //assert Assert.IsFalse(Object.ReferenceEquals(a, c)); Assert.AreEqual(a, c); Assert.AreEqual("D", a); Assert.AreEqual("InterfaceNamespace.Interface", a.ExplicitInterface.ToString()); }
public void DotNetQualifiedName_Equality_ListContains() { //arrange List <DotNetQualifiedName> list = new List <DotNetQualifiedName>() { DotNetQualifiedName.FromVisualStudioXml("System"), DotNetQualifiedName.FromVisualStudioXml("System.Collections.Generic"), DotNetQualifiedName.FromVisualStudioXml("System.Linq"), DotNetQualifiedName.FromVisualStudioXml("System.Text"), DotNetQualifiedName.FromVisualStudioXml("System.Threading.Tasks") }; DotNetQualifiedName target = DotNetQualifiedName.FromVisualStudioXml("System.Text"); //act bool result = list.Contains(target); //assert Assert.AreEqual(true, result); }