public static void Compare(PropertyDeclarationSyntax x, PropertyDeclarationSyntax y) { Assert.AreEqual(-1, PropertyDeclarationComparer.Compare(x, y)); Assert.AreEqual(1, PropertyDeclarationComparer.Compare(y, x)); Assert.AreEqual(0, PropertyDeclarationComparer.Compare(x, x)); Assert.AreEqual(0, PropertyDeclarationComparer.Compare(y, y)); }
public static void NoSpan(string code1, string code2) { var x = (PropertyDeclarationSyntax)SyntaxFactory.ParseCompilationUnit(code1).Members.Single(); var y = (PropertyDeclarationSyntax)SyntaxFactory.ParseCompilationUnit(code2).Members.Single(); Assert.AreEqual(-1, PropertyDeclarationComparer.Compare(x, y)); Assert.AreEqual(1, PropertyDeclarationComparer.Compare(y, x)); }
public static void InitializedWithOther(PropertyDeclarationSyntax x, PropertyDeclarationSyntax y) { Assert.AreEqual(-1, PropertyDeclarationComparer.Compare(x, y)); Assert.AreEqual(1, PropertyDeclarationComparer.Compare(y, x)); Assert.AreEqual(0, PropertyDeclarationComparer.Compare(x, x)); Assert.AreEqual(0, PropertyDeclarationComparer.Compare(y, y)); Assert.AreEqual(-1, MemberDeclarationComparer.Compare(x, y)); Assert.AreEqual(1, MemberDeclarationComparer.Compare(y, x)); Assert.AreEqual(0, MemberDeclarationComparer.Compare(x, x)); Assert.AreEqual(0, MemberDeclarationComparer.Compare(y, y)); }
public static void InitializedWithOther() { var syntaxTree = CSharpSyntaxTree.ParseText(@" namespace N { class C { public static int PublicStatic1 { get; } = PublicStatic2; public static int PublicStatic2 { get; } = 3; } }"); var x = syntaxTree.FindPropertyDeclaration("public static int PublicStatic1 { get; } = PublicStatic2"); var y = syntaxTree.FindPropertyDeclaration("public static int PublicStatic2 { get; } = 3"); Assert.AreEqual(1, PropertyDeclarationComparer.Compare(x, y)); Assert.AreEqual(-1, PropertyDeclarationComparer.Compare(y, x)); Assert.AreEqual(0, PropertyDeclarationComparer.Compare(x, x)); Assert.AreEqual(0, PropertyDeclarationComparer.Compare(y, y)); }