public void Can_Configure_ReferenceControls() { //Arrange var expected = new XElement("LookupControls", new XAttribute("returnRelationsAsAttributes", "true"), new XElement("AttributesToReturn", new XElement("Attribute", new XAttribute("name", "Artikelnummer"))), new XElement("LanguagesToReturn", new XElement("Language", new XAttribute("id", "10"))), new XElement("ReferenceControls", new XAttribute("valueOnly", "true"))); var builder = new LookupControlBuilder(); //Act builder.AddRequestFilters(Filter.ReturnRelationsAsAttributes()) .ReturnAttributes(AttributeToReturn.WithName("Artikelnummer")) .ReturnLanguages(LanguageToReturn.WithLanguageId(10)) .ConfigureReferenceHandling(ReferenceOptions.ReturnValuesOnly()); var request = builder.Build().ToAdsml(); //Assert Assert.That(request.ToString(), Is.EqualTo(expected.ToString())); }
public void Can_Add_Request_Filters() { //Arrange var expected = new XElement("LookupControls", new XAttribute("returnRelationsAsAttributes", "true")); var builder = new LookupControlBuilder(); //Act builder.AddRequestFilters(Filter.ReturnRelationsAsAttributes()); var request = builder.Build().ToAdsml(); //Assert Assert.That(request.ToString(), Is.EqualTo(expected.ToString())); }
public void Can_Restrict_Returned_Attributes() { //Arrange var expected = new XElement("LookupControls", new XAttribute("returnRelationsAsAttributes", "true"), new XElement("AttributesToReturn", new XElement("Attribute", new XAttribute("name", "Artikelnummer")))); var builder = new LookupControlBuilder(); //Act builder.AddRequestFilters(Filter.ReturnRelationsAsAttributes()) .ReturnAttributes(AttributeToReturn.WithName("Artikelnummer")); var request = builder.Build().ToAdsml(); //Assert Assert.That(request.ToString(), Is.EqualTo(expected.ToString())); }