コード例 #1
0
        public void SyntaxTypeReference_With_Type_Null()
        {
            // arrange
            SyntaxTypeReference typeReference1 = TypeReference.Create(
                "Foo",
                TypeContext.Input,
                scope: "foo");

            // act
            Action action = () => typeReference1.With(null);

            // assert
            Assert.Throws <ArgumentNullException>(action);
        }
コード例 #2
0
        public void SyntaxTypeReference_With_Scope()
        {
            // arrange
            SyntaxTypeReference typeReference1 = TypeReference.Create(
                "Foo",
                TypeContext.Input,
                scope: "foo");

            // act
            SyntaxTypeReference typeReference2 = typeReference1.With(scope: "bar");

            // assert
            Assert.Equal(typeReference1.Type, typeReference2.Type);
            Assert.Equal(typeReference1.Context, typeReference2.Context);
            Assert.Equal("bar", typeReference2.Scope);
        }
コード例 #3
0
        public void SyntaxTypeReference_With_Context()
        {
            // arrange
            SyntaxTypeReference typeReference1 = TypeReference.Create(
                "Foo",
                TypeContext.Input,
                scope: "foo");

            // act
            SyntaxTypeReference typeReference2 = typeReference1.With(context: TypeContext.None);

            // assert
            Assert.Equal(typeReference1.Type, typeReference2.Type);
            Assert.Equal(TypeContext.None, typeReference2.Context);
            Assert.Equal(typeReference1.Scope, typeReference2.Scope);
        }
コード例 #4
0
        public void SyntaxTypeReference_With_Type()
        {
            // arrange
            SyntaxTypeReference typeReference1 = TypeReference.Create(
                "Foo",
                TypeContext.Input,
                scope: "foo");

            // act
            SyntaxTypeReference typeReference2 = typeReference1.With(new NamedTypeNode("Bar"));

            // assert
            Assert.Equal("Bar", Assert.IsType <NamedTypeNode>(typeReference2.Type).Name.Value);
            Assert.Equal(typeReference1.Context, typeReference2.Context);
            Assert.Equal(typeReference1.Scope, typeReference2.Scope);
        }
コード例 #5
0
        public void SyntaxTypeReference_With_Nullable()
        {
            // arrange
            SyntaxTypeReference typeReference1 = TypeReference.Create(
                "Foo",
                TypeContext.Input,
                scope: "foo",
                nullable: new[] { true });

            // act
            SyntaxTypeReference typeReference2 = typeReference1.With(nullable: null);

            // assert
            Assert.Equal(typeReference1.Type, typeReference2.Type);
            Assert.Equal(typeReference1.Context, typeReference2.Context);
            Assert.Equal(typeReference1.Scope, typeReference2.Scope);
            Assert.Null(typeReference2.Nullable);
        }
コード例 #6
0
        public void SyntaxTypeReference_With()
        {
            // arrange
            SyntaxTypeReference typeReference1 = TypeReference.Create(
                "Foo",
                TypeContext.Input,
                scope: "foo",
                nullable: new[] { true });

            // act
            SyntaxTypeReference typeReference2 = typeReference1.With(
                new NamedTypeNode("Bar"),
                TypeContext.Output,
                scope: "bar",
                nullable: new[] { false });

            // assert
            Assert.Equal("Bar", Assert.IsType <NamedTypeNode>(typeReference2.Type).Name.Value);
            Assert.Equal(TypeContext.Output, typeReference2.Context);
            Assert.Equal("bar", typeReference2.Scope);
            Assert.Collection(typeReference2.Nullable !, Assert.False);
        }