public void Can_Combine_All_Operations() { //Arrange var builder = new ModifyRequestBuilder(); //Act builder.Context("/foo/bar") .ReturnNoAttributes() .FailOnError() .AddModification(Modifications.RemoveAttribute, SimpleAttribute.New(AttributeTypes.Integer, "objectId")) .AddModifications(() => new List <ModificationItem> { ModificationItem.New( Modifications.AdvanceState, StructureAttribute.New(390, new StructureValue(10)) ), ModificationItem.New( Modifications.RegressState, StructureAttribute.New(24, new StructureValue(10)) ) }) .ConfigureLookupControls() .ReturnAttributes(390, 24) .ReturnLanguages(10); var request = new BatchRequest(builder.Build()); Console.WriteLine(builder.Build().ToAdsml().ToString()); //Assert Assert.DoesNotThrow(() => builder.Build()); Assert.DoesNotThrow(() => request.ToAdsml().ValidateAdsmlDocument("adsml.xsd")); }
public void Can_Build_ModifyRequest() { //Arrange var builder = new ModifyRequestBuilder(); //Act builder.Context("/foo/bar") .AddModification(Modifications.RemoveAttribute, SimpleAttribute.New(AttributeTypes.Integer, "objectId")); var request = builder.Build(); var batchRequest = new BatchRequest(request); //Assert Assert.That(request, Is.Not.Null); Assert.That(request, Is.InstanceOf <ModifyRequest>()); Assert.DoesNotThrow(() => batchRequest.ToAdsml().ValidateAdsmlDocument("adsml.xsd")); }
public void Can_Build_ModifyRequest_With_Request_Filters() { //Arrange var builder = new ModifyRequestBuilder(); //Act builder.Context("/foo/bar") .ReturnNoAttributes() .FailOnError() .AddModification(Modifications.RemoveAttribute, SimpleAttribute.New(AttributeTypes.Integer, "objectId")); var request = builder.Build(); var batchRequest = new BatchRequest(request); //Assert Assert.That(request.RequestFilters.Count(), Is.EqualTo(2)); Assert.That(request.RequestFilters.ElementAt(0), Is.InstanceOf <ReturnNoAttributesFilter>()); Assert.That(request.RequestFilters.ElementAt(1), Is.InstanceOf <FailOnErrorFilter>()); Assert.DoesNotThrow(() => batchRequest.ToAdsml().ValidateAdsmlDocument("adsml.xsd")); }