public void If_Arguments_For_Object_Fields_Are_Null_Or_Empty_Then_Arguments_For_Field_Selection_Are_Empty( IArgumentCollection arguments) { var contactSelection = SelectionSetBuilder.For <Contact>() .AddScalarField(contact => contact.FirstName) .Build(); var selectionSet = SelectionSetBuilder.For <Customer>() .AddObjectField(customer => customer.CustomerContact, arguments, contactSelection) .AddObjectField("foobar", customer => customer.CustomerContact, arguments, contactSelection) .Build(); var expectedContactSelectionSet = new SelectionSet <Contact>( new ISelectionSetItem[] { new ScalarFieldSelectionItem(null, nameof(Contact.FirstName)) }); var expectedSelections = new ISelectionSetItem[] { new ObjectFieldSelectionItem(null, nameof(Customer.CustomerContact), Enumerable.Empty <IArgument>(), expectedContactSelectionSet), new ObjectFieldSelectionItem("foobar", nameof(Customer.CustomerContact), Enumerable.Empty <IArgument>(), expectedContactSelectionSet), }; selectionSet.Should().NotBeNull(); selectionSet.Selections.Should() .BeEquivalentTo(expectedSelections, options => options.RespectingRuntimeTypes()); }
public void If_Arguments_For_Object_Collection_Fields_Are_Null_Or_Empty_Then_Arguments_For_Field_Selection_Are_Empty( IArgumentCollection arguments) { var phoneNumberSelectionSet = SelectionSetBuilder.For <PhoneNumber>() .AddScalarField(phone => phone.Number) .AddScalarField(phone => phone.Extension) .Build(); var selectionSet = SelectionSetBuilder.For <Contact>() .AddObjectCollectionField(contact => contact.PhoneNumbers, arguments, phoneNumberSelectionSet) .AddObjectCollectionField("foobar", contact => contact.PhoneNumbers, arguments, phoneNumberSelectionSet) .Build(); var expectedPhoneNumberSelectionSet = new SelectionSet <PhoneNumber>( new ISelectionSetItem[] { new ScalarFieldSelectionItem(null, nameof(PhoneNumber.Number)), new ScalarFieldSelectionItem(null, nameof(PhoneNumber.Extension)) }); var expectedSelections = new ISelectionSetItem[] { new ObjectFieldSelectionItem(null, nameof(Contact.PhoneNumbers), Enumerable.Empty <IArgument>(), expectedPhoneNumberSelectionSet), new ObjectFieldSelectionItem("foobar", nameof(Contact.PhoneNumbers), Enumerable.Empty <IArgument>(), expectedPhoneNumberSelectionSet), }; selectionSet.Should().NotBeNull(); selectionSet.Selections.Should() .BeEquivalentTo(expectedSelections, options => options.RespectingRuntimeTypes()); }
public void If_Arguments_For_Scalar_Collection_Fields_Are_Null_Or_Empty_Then_Arguments_For_Field_Selection_Are_Empty( IArgumentCollection arguments) { var selectionSet = SelectionSetBuilder.For <Customer>() .AddScalarCollectionField(customer => customer.FavoriteNumbers, arguments) .AddScalarCollectionField("numbers", customer => customer.FavoriteNumbers, arguments) .Build(); var expectedSelections = new ISelectionSetItem[] { new ScalarFieldSelectionItem(null, nameof(Customer.FavoriteNumbers)), new ScalarFieldSelectionItem("numbers", nameof(Customer.FavoriteNumbers)), }; selectionSet.Should().NotBeNull(); selectionSet.Selections.Should() .BeEquivalentTo(expectedSelections, options => options.RespectingRuntimeTypes()); }
public ISelectionSetItemObject(ISelectionSetItem ISelectionSetIteminstance) { ISelectionSetItemInstance = ISelectionSetIteminstance; }