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); }
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); }
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); }
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); }
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); }
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); }