public void WithLocation() { // arrange Location location = AstTestHelper.CreateDummyLocation(); var selections = new List <ISelectionNode> { new FieldNode ( null, new NameNode("bar"), null, Array.Empty <DirectiveNode>(), Array.Empty <ArgumentNode>(), null ) }; var selectionSet = new SelectionSetNode ( null, selections ); // act selectionSet = selectionSet.WithLocation(location); // assert selectionSet.MatchSnapshot(); }
public void Create_Name_LocationNull_ArgumentNullException() { // arrange Location location = AstTestHelper.CreateDummyLocation(); // act Action action = () => new VariableNode(location, null); // assert Assert.Throws <ArgumentNullException>(action); }
public void WithLocation_Location_NewObjectHasNewLocation() { // arrange var foo = new NameNode("foo"); var node = new VariableNode(foo); Location location = AstTestHelper.CreateDummyLocation(); // act node = node.WithLocation(location); // assert Assert.Equal(location, node.Location); }
public void Create_Name_LocationFoo_LocationAndNameIsPassed() { // arrange var name = new NameNode("foo"); Location location = AstTestHelper.CreateDummyLocation(); // act var node = new VariableNode(location, name); // assert Assert.Equal(location, node.Location); Assert.Equal(name, node.Name); }
public void WithLocation() { // arrange var name = new NameNode("foo"); var description = new StringValueNode("bar"); var arguments = new List <InputValueDefinitionNode>(); var locations = new List <NameNode>(); var directiveDefinition = new DirectiveDefinitionNode( null, name, description, true, arguments, locations); // act directiveDefinition = directiveDefinition .WithLocation(AstTestHelper.CreateDummyLocation()); // assert directiveDefinition.MatchSnapshot(); }