internal InputField(ArgumentDescription argumentDescription) : base(argumentDescription) { _nativeDefaultValue = argumentDescription.NativeDefaultValue; SyntaxNode = argumentDescription.SyntaxNode; DefaultValue = argumentDescription.DefaultValue; }
private InputField( ArgumentDescription argumentDescription, DirectiveLocation location) : base(argumentDescription, location) { _nativeDefaultValue = argumentDescription.NativeDefaultValue; SyntaxNode = argumentDescription.SyntaxNode; DefaultValue = argumentDescription.DefaultValue; }
public void GetNameAndType() { // act var descriptor = new ArgumentDescriptor("args", typeof(string)); // assert ArgumentDescription description = descriptor.CreateDescription(); Assert.Equal("args", description.Name); Assert.Equal(typeof(string), description.TypeReference.ClrType); }
public void SetTypeInstance() { // arrange var descriptor = new ArgumentDescriptor("Type"); // act ((IArgumentDescriptor)descriptor).Type(new StringType()); // assert ArgumentDescription description = descriptor.CreateDescription(); TypeReference typeRef = description.TypeReference; Assert.IsType <StringType>(typeRef.SchemaType); }
public void SetDefaultValueNull() { // arrange var descriptor = new ArgumentDescriptor("args"); // act ((IArgumentDescriptor)descriptor).DefaultValue(null); // assert ArgumentDescription description = descriptor.CreateDescription(); Assert.Equal(NullValueNode.Default, description.DefaultValue); Assert.Null(description.NativeDefaultValue); }
public void SchemaTypesOverwriteDotNetTypes() { // arrange var descriptor = new ArgumentDescriptor("Type"); // act ((IArgumentDescriptor)descriptor) .Type <NativeType <IReadOnlyDictionary <string, string> > >() .Type <ListType <StringType> >(); // assert ArgumentDescription description = descriptor.CreateDescription(); TypeReference typeRef = description.TypeReference; Assert.Equal(typeof(ListType <StringType>), typeRef.ClrType); }
public void OverwriteDefaultValueLiteralWithNativeDefaultValue() { // arrange var descriptor = new ArgumentDescriptor("args"); // act ((IArgumentDescriptor)descriptor) .DefaultValue(new StringValueNode("123")) .DefaultValue("string"); // assert ArgumentDescription description = descriptor.CreateDescription(); Assert.Null(description.DefaultValue); Assert.Equal("string", description.NativeDefaultValue); }
public void SetDefaultValueAndInferType() { // arrange var descriptor = new ArgumentDescriptor("args"); // act ((IArgumentDescriptor)descriptor).DefaultValue("string"); // assert ArgumentDescription description = descriptor.CreateDescription(); Assert.Equal(typeof(string), description.TypeReference.ClrType); Assert.Equal("string", description.NativeDefaultValue); }
public void SettingTheNativeDefaultValueToNullCreatesNullLiteral() { // arrange var descriptor = new ArgumentDescriptor("args"); // act ((IArgumentDescriptor)descriptor) .DefaultValue(new StringValueNode("123")) .DefaultValue("string") .DefaultValue(null); // assert ArgumentDescription description = descriptor.CreateDescription(); Assert.IsType <NullValueNode>(description.DefaultValue); Assert.Null(description.NativeDefaultValue); }
internal InputField(ArgumentDescription argumentDescription) : this(argumentDescription, DirectiveLocation.ArgumentDefinition) { }