예제 #1
0
        public void Object_Equals_Scope_Different()
        {
            // arrange
            SyntaxTypeReference x = TypeReference.Create(
                "Foo",
                TypeContext.None,
                scope: "a");

            SyntaxTypeReference y = TypeReference.Create(
                "Foo",
                TypeContext.Output,
                scope: "a");

            SyntaxTypeReference z = TypeReference.Create(
                "Foo",
                TypeContext.Input);

            // act
            var xy = x.Equals((object)y);
            var xz = x.Equals((object)z);
            var yz = y.Equals((object)z);

            // assert
            Assert.True(xy);
            Assert.False(xz);
            Assert.False(yz);
        }
예제 #2
0
        public void SyntaxTypeReference_Equals_Context_None_Does_Not_Matter()
        {
            // arrange
            SyntaxTypeReference x = TypeReference.Create(
                "Foo",
                TypeContext.None);

            SyntaxTypeReference y = TypeReference.Create(
                "Foo",
                TypeContext.Output);

            SyntaxTypeReference z = TypeReference.Create(
                "Foo",
                TypeContext.Input);

            // act
            var xy = x.Equals(y);
            var xz = x.Equals(z);
            var yz = y.Equals(z);

            // assert
            Assert.True(xy);
            Assert.True(xz);
            Assert.False(yz);
        }
        public void Object_Equals_Nullability()
        {
            // arrange
            SyntaxTypeReference x = TypeReference.Create(
                "Foo",
                TypeContext.None,
                nullable: new bool[] { true, false });

            SyntaxTypeReference y = TypeReference.Create(
                "Foo",
                TypeContext.Output,
                nullable: new bool[] { false, false });

            SyntaxTypeReference z = TypeReference.Create(
                "Foo",
                TypeContext.Input,
                nullable: new bool[] { true, false });

            // act
            var xy = x.Equals((object)y);
            var xz = x.Equals((object)z);
            var yz = y.Equals((object)z);

            // assert
            Assert.False(xy);
            Assert.True(xz);
            Assert.False(yz);
        }
예제 #4
0
        public void ISyntaxTypeReference_Equals_True(
            string typeName,
            TypeContext context,
            bool?isTypeNullable,
            bool?isElementTypeNullable)
        {
            // arrange
            var x = new SyntaxTypeReference(
                new NamedTypeNode(typeName),
                context,
                isTypeNullable,
                isElementTypeNullable);

            ISyntaxTypeReference y = new SyntaxTypeReference(
                new NamedTypeNode(typeName),
                context,
                isTypeNullable,
                isElementTypeNullable);

            // act
            bool result = x.Equals(y);

            // assert
            Assert.True(result);
        }
예제 #5
0
        public void SyntaxTypeReference_Equals_To_Same()
        {
            // arrange
            SyntaxTypeReference x = TypeReference.Create(
                "Foo",
                TypeContext.None);

            // act
            var xx = x.Equals((SyntaxTypeReference)x);

            // assert
            Assert.True(xx);
        }
예제 #6
0
        public void SyntaxTypeReference_Equals_To_Null()
        {
            // arrange
            SyntaxTypeReference x = TypeReference.Create(
                "Foo",
                TypeContext.None);

            // act
            var result = x.Equals((SyntaxTypeReference)null);

            // assert
            Assert.False(result);
        }
예제 #7
0
        public void Object_Equals_To_Object()
        {
            // arrange
            SyntaxTypeReference x = TypeReference.Create(
                "Foo",
                TypeContext.None);

            // act
            var xx = x.Equals(new object());

            // assert
            Assert.False(xx);
        }
예제 #8
0
        public void ITypeReference_Equals_To_SyntaxTypeRef()
        {
            // arrange
            SyntaxTypeReference x = TypeReference.Create(
                "Foo",
                TypeContext.None);

            // act
            var xx = x.Equals(TypeReference.Create(_typeInspector.GetType(typeof(int))));

            // assert
            Assert.False(xx);
        }
예제 #9
0
        public void Object_NullEquals_False()
        {
            // arrange
            var x = new SyntaxTypeReference(
                new NamedTypeNode("abc"),
                TypeContext.Input,
                true,
                false);

            // act
            bool result = x.Equals((object)null);

            // assert
            Assert.False(result);
        }
예제 #10
0
        public void ISyntaxTypeReference_RefEquals_True()
        {
            // arrange
            var x = new SyntaxTypeReference(
                new NamedTypeNode("abc"),
                TypeContext.Input,
                true,
                false);

            // act
            bool result = x.Equals((ISyntaxTypeReference)x);

            // assert
            Assert.True(result);
        }
예제 #11
0
        public void ISyntaxTypeReference_Equals_False()
        {
            // arrange
            var x = new SyntaxTypeReference(
                new NamedTypeNode("abc"),
                TypeContext.Input,
                true,
                false);

            ISyntaxTypeReference y = new SyntaxTypeReference(
                new NamedTypeNode("cde"),
                TypeContext.Input,
                true,
                false);

            // act
            bool result = x.Equals(y);

            // assert
            Assert.False(result);
        }