public static ISchemaBuilder AddResolver( this ISchemaBuilder builder, FieldCoordinate field, FieldResolverDelegate resolver, Type?resultType = null) { if (builder is null) { throw new ArgumentNullException(nameof(builder)); } if (!field.HasValue) { throw new ArgumentException( TypeResources.SchemaBuilderExtensions_AddResolver_EmptyCooridnates, nameof(builder)); } if (resolver is null) { throw new ArgumentNullException(nameof(resolver)); } return(AddResolverConfigInternal(builder, field, resolver, resultType)); }
public void ToString_Field() { // arrange var fieldCoordinate = new FieldCoordinate("abc", "def"); // act // assert Assert.Equal("abc.def", fieldCoordinate.ToString()); }
public void HasValue_True() { // arrange var fieldCoordinate = new FieldCoordinate("abc", "def"); // act // assert Assert.True(fieldCoordinate.HasValue); }
public void HasValue_False() { // arrange var fieldCoordinate = new FieldCoordinate(); // act // assert Assert.False(fieldCoordinate.HasValue); }
public void CreateWithoutTypeName() { // arrange // act var fieldCoordinate = FieldCoordinate.CreateWithoutType("abc"); // assert Assert.Equal("__Empty.abc", fieldCoordinate.ToString()); }
public void GetHashCode_Field_Argument() { // arrange var a = new FieldCoordinate("abc", "def", "ghi"); var b = new FieldCoordinate("abc", "def", "ghi"); // act // assert Assert.Equal(a.GetHashCode(), b.GetHashCode()); }
public void Object_Equals_Argument_False() { // arrange var a = new FieldCoordinate("abc", "def", "ghi"); var b = new FieldCoordinate("abc", "def", "xyz"); // act // assert Assert.False(a.Equals((object)b)); }
public void Equals_Argument_True() { // arrange var a = new FieldCoordinate("abc", "def", "ghi"); var b = new FieldCoordinate("abc", "def", "ghi"); // act // assert Assert.True(a.Equals(b)); }
public void Equals_Field_To_Arg_False() { // arrange var a = new FieldCoordinate("abc", "def"); var b = new FieldCoordinate("abc", "def", "ghi"); // act // assert Assert.False(a.Equals(b)); }
public void With_FieldName() { // arrange var fieldCoordinate = new FieldCoordinate("abc", "def"); // act fieldCoordinate = fieldCoordinate.With(fieldName: new NameString("xyz")); // assert Assert.Equal("abc.xyz", fieldCoordinate.ToString()); }
public void With_Argument() { // arrange var fieldCoordinate = new FieldCoordinate("abc", "def"); // act fieldCoordinate = fieldCoordinate.With(argumentName: new NameString("xyz")); // assert Assert.Equal("abc.def(xyz)", fieldCoordinate.ToString()); }
public void Deconstruct_Coordinates() { // arrange var a = new FieldCoordinate("abc", "def", "ghi"); var b = new FieldCoordinate("abc", "def"); // act (NameString at, NameString af, NameString? aa) = a; (NameString bt, NameString bf, NameString? ba) = b; // assert Assert.Equal(a.TypeName, at); Assert.Equal(a.FieldName, af); Assert.Equal(a.ArgumentName, aa); Assert.Equal(b.TypeName, bt); Assert.Equal(b.FieldName, bf); Assert.Equal(b.ArgumentName, ba); }