public async Task SchemaTypeReference_With_Type_Null() { // arrange StringType stringType = await CreateTypeAsync <StringType>(); SchemaTypeReference typeReference1 = TypeReference.Create( stringType, scope: "foo"); // act Action action = () => typeReference1.With(null); // assert Assert.Throws <ArgumentNullException>(action); }
public async Task SchemaTypeReference_With_Scope() { // arrange StringType stringType = await CreateTypeAsync <StringType>(); SchemaTypeReference typeReference1 = TypeReference.Create( stringType, scope: "foo"); // act SchemaTypeReference typeReference2 = typeReference1.With(scope: "bar"); // assert Assert.Equal(typeReference1.Type, typeReference2.Type); Assert.Equal(typeReference1.Context, typeReference2.Context); Assert.Equal("bar", typeReference2.Scope); }
public async Task SchemaTypeReference_With_Nullable() { // arrange StringType stringType = await CreateTypeAsync <StringType>(); SchemaTypeReference typeReference1 = TypeReference.Create( stringType, scope: "foo", nullable: new[] { true }); // act SchemaTypeReference 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 async Task SchemaTypeReference_With() { // arrange StringType stringType = await CreateTypeAsync <StringType>(); IntType intType = await CreateTypeAsync <IntType>(); SchemaTypeReference typeReference1 = TypeReference.Create( stringType, scope: "foo", nullable: new[] { true }); // act SchemaTypeReference typeReference2 = typeReference1.With( intType, scope: "bar", nullable: new[] { false }); // assert Assert.Equal(intType, typeReference2.Type); Assert.Equal(TypeContext.None, typeReference2.Context); Assert.Equal("bar", typeReference2.Scope); Assert.Collection(typeReference2.Nullable !, Assert.False); }