/// <summary> /// test getInfo() and check result against created resp. updated User /// </summary> /// <param name="alreadyUpdated">check result against created or updated User</param> public void getInfo(bool alreadyUpdated) { string[] UserPaths = new string[] { path + alias }; ArrayList Users_out = serviceClient.getInfo(UserPaths, new string[] { "ChallengePhrase" }); // test if getinfo was successful and if all data are equal to input Assert.AreEqual(1, Users_out.Count, "get info result set"); TGetInfo_Return User_out = (TGetInfo_Return)Users_out.ToArray()[0]; Assert.AreEqual(alias, User_out.Alias, "user alias"); Hashtable outAddresses = new Hashtable(); foreach (TAddressNamed address in User_out.AdditionalAddresses) { outAddresses.Add(address.Street, address); } if (alreadyUpdated) { Assert.AreEqual(User_update.Name, User_out.Name, "Name"); Assert.AreEqual(User_update.BillingAddress.FirstName, User_out.BillingAddress.FirstName, "getInfo() updated FirstName"); Assert.AreEqual(User_update.BillingAddress.LastName, User_out.BillingAddress.LastName, "getInfo() updated LastName"); Assert.AreEqual(User_update.BillingAddress.Street, User_out.BillingAddress.Street, "getInfo() updated Street"); Assert.AreEqual(User_update.Attributes[0].Value, User_out.Attributes[0].Value, "getInfo() updated ChallengePhrase"); Assert.AreEqual(User_update.DeleteConfirmation, User_out.DeleteConfirmation, "getInfo() updated DeleteConfirmation"); foreach (TAddressNamed upAddress in User_update.AdditionalAddresses) { TAddressNamed outAddress = (TAddressNamed)outAddresses[upAddress.Street]; if (upAddress.Alias != null && upAddress.Alias != "") { Assert.AreEqual(upAddress.Alias, outAddress.Alias, "getInfo() updated AdditionalAddresses Alias"); } Assert.AreEqual(upAddress.LastName, outAddress.LastName, "getInfo() updated AdditionalAddresses LastName"); } } else { Assert.AreEqual(User_in.Name, User_out.Name, "Name"); Assert.AreEqual(User_in.BillingAddress.FirstName, User_out.BillingAddress.FirstName, "getInfo() original FirstName"); Assert.AreEqual(User_in.BillingAddress.LastName, User_out.BillingAddress.LastName, "getInfo() original LastName"); Assert.AreEqual(User_in.BillingAddress.Street, User_out.BillingAddress.Street, "getInfo() original Street"); Assert.AreEqual(User_in.Attributes[0].Value, User_out.Attributes[0].Value, "getInfo() original ChallengePhrase"); Assert.AreEqual(User_in.DeleteConfirmation, User_out.DeleteConfirmation, "getInfo() original DeleteConfirmation"); Assert.AreEqual(User_in.AdditionalAddresses.Length, User_out.AdditionalAddresses.Length, "getInfo() original number AdditionalAddresses"); foreach (TAddressNamed inAddress in User_in.AdditionalAddresses) { TAddressNamed outAddress = (TAddressNamed)outAddresses[inAddress.Street]; if (inAddress.Alias != null && inAddress.Alias != "") { Assert.AreEqual(inAddress.Alias, outAddress.Alias, "getInfo() original AdditionalAddresses Alias"); } Assert.AreEqual(inAddress.LastName, outAddress.LastName, "getInfo() original AdditionalAddresses LastName"); } } Assert.AreEqual(User_in.EMail, User_out.EMail, "getInfo() EMail"); Assert.IsFalse(User_out.Password == User_in.Password, "getInfo() Password"); }
public void Init() { serviceClient = new CustomerService4Client(); // create test customers that can be used with the create and update methods customer_in.Alias = alias; TAddressNamed bill = new TAddressNamed(); bill.FirstName = "Klaus"; bill.LastName = "Klaussen"; bill.Street = "Musterstraße 2"; bill.CodePorte = "abc"; bill.EMail = "*****@*****.**"; bill.Birthday = new DateTime(1976, 9, 25, 11, 33, 0, DateTimeKind.Local); bill.BirthdaySpecified = true; bill.VerifiedOn = new DateTime(2005, 1, 1); bill.VerifiedOnSpecified = true; customer_in.BillingAddress = bill; TAttribute attr = new TAttribute(); attr.Name = "Comment"; attr.Value = "my customer comment"; customer_in.Attributes = new TAttribute[] { attr }; customer_in.IsDoOrderAllowed = true; customer_update.Path = path + alias; TAddressNamed bill_update = new TAddressNamed(); bill_update.FirstName = "Hans"; bill_update.LastName = "Hanssen"; bill_update.Street = "Musterstraße 2b"; bill_update.CodePorte = "abcdef"; bill_update.Birthday = new DateTime(1976, 9, 25, 11, 33, 0, DateTimeKind.Local); bill_update.BirthdaySpecified = true; bill_update.VerifiedOn = new DateTime(2005, 1, 1); bill_update.VerifiedOnSpecified = true; customer_update.BillingAddress = bill_update; TAttribute attr_update = new TAttribute(); attr_update.Name = "Comment"; attr_update.Value = "my updated customer comment"; customer_update.Attributes = new TAttribute[] { attr_update }; customer_update.IsDoOrderAllowed = true; }
public void Init() { // initialize orderService orderService = new OrderService(); orderService.Credentials = new System.Net.NetworkCredential(WEBSERVICE_LOGIN, WEBSERVICE_PASSWORD); orderService.PreAuthenticate = true; orderService.Url = WEBSERVICE_URL; // initialize addresses TAddressNamed Address_in = new TAddressNamed(); Address_in.EMail = "*****@*****.**"; Address_in.FirstName = "Klaus"; Address_in.LastName = "Klaussen"; Address_in.Street = "Musterstraße 2"; Address_in.Street2 = "Ortsteil Niederfingeln"; TAttribute jobTitle = new TAttribute(); jobTitle.Name = "JobTitle"; jobTitle.Value = "best Job"; TAttribute salutation = new TAttribute(); salutation.Name = "Salutation"; salutation.Value = "Dr."; Address_in.Attributes = new TAttribute[] { jobTitle, salutation }; TAddressNamed Address_up = new TAddressNamed(); Address_up.FirstName = "Hans"; Address_up.LastName = "Hanssen"; Address_up.Street = "Musterstraße 2b"; Address_up.Street2 = "Ortsteil Oberfingeln"; //initialize order input data Order_in.Alias = alias; Order_in.Customer = customer; Order_in.BillingAddress = Address_in; Order_in.CreationDate = new DateTime(2006, 1, 1, 12, 0, 0, DateTimeKind.Local); Order_in.ViewedOn = new DateTime(2006, 1, 1, 23, 59, 0, DateTimeKind.Local); Order_in.ViewedOnSpecified = true; TAttribute OrderAttr_in = new TAttribute(); OrderAttr_in.Name = "Comment"; OrderAttr_in.Value = "my order comment"; Order_in.Attributes = new TAttribute[] { OrderAttr_in }; TProductLineItemIn Product_in = new TProductLineItemIn(); Product_in.Product = "/Shops/DemoShop/Products/ho_1112105010"; Product_in.Quantity = 10; TLineItemContainerIn lineItemContainer = new TLineItemContainerIn(); lineItemContainer.CurrencyID = "EUR"; lineItemContainer.PaymentMethod = "/Shops/DemoShop/PaymentMethods/Invoice"; lineItemContainer.ShippingMethod = "/Shops/DemoShop/ShippingMethods/Express"; lineItemContainer.TaxArea = "/TaxMatrixGermany/EU"; lineItemContainer.TaxModel = "gross"; lineItemContainer.ProductLineItems = new TProductLineItemIn[] { Product_in }; Order_in.LineItemContainer = lineItemContainer; //initialize order update data Order_up.Path = path; Order_up.BillingAddress = Address_up; Order_up.InProcessOn = new DateTime(2006, 1, 2, 0, 0, 0, DateTimeKind.Local); Order_up.InProcessOnSpecified = true; TAttribute OrderAttr_up = new TAttribute(); OrderAttr_up.Name = "Comment"; OrderAttr_up.Value = "my updated order comment"; Order_up.Attributes = new TAttribute[] { OrderAttr_up }; }
public void Init() { serviceClient = new UserService5Client(); // create test users that can be used with the create and update methods User_in.Alias = alias; User_in.Password = "******"; User_in.Name = "Klaus Klaussen"; User_in.EMail = "*****@*****.**"; User_in.DeleteConfirmation = false; User_in.DeleteConfirmationSpecified = true; User_update.DeleteConfirmation = true; User_update.DeleteConfirmationSpecified = true; TAddressNamed bill = new TAddressNamed(); bill.Alias = "bill"; bill.FirstName = "Klaus"; bill.LastName = "Klaussen2"; bill.Street = "Musterstraße 2"; bill.CodePorte = "xyz"; bill.EMail = "*****@*****.**"; bill.Birthday = new DateTime(1976, 9, 25, 11, 33, 0); User_in.BillingAddress = bill; TAddressNamed ship = new TAddressNamed(); ship.Alias = "ship"; ship.FirstName = "Klaus"; ship.LastName = "Klaussen3"; ship.Street = "Musterstraße 3"; ship.EMail = "*****@*****.**"; ship.Birthday = new DateTime(1976, 9, 25, 11, 33, 0); User_in.ShippingAddress = ship; TAddressNamed ship1 = new TAddressNamed(); ship1.Alias = "ship1"; ship1.FirstName = "Klaus"; ship1.LastName = "Klaussen4"; ship1.Street = "Musterstraße 4"; ship1.EMail = "*****@*****.**"; ship1.Birthday = new DateTime(1976, 9, 25, 11, 33, 0); TAddressNamed ship2 = new TAddressNamed(); //--- test without Alias ship2.FirstName = "Klaus"; ship2.LastName = "Klaussen5"; ship2.Street = "Musterstraße 5"; ship2.EMail = "*****@*****.**"; ship2.Birthday = new DateTime(1976, 9, 25, 11, 33, 0); TAddressNamed[] addresses = new TAddressNamed[] { ship1, ship2, }; User_in.AdditionalAddresses = addresses; TAttribute attr = new TAttribute(); attr.Name = "ChallengePhrase"; attr.Value = "my challenge phrase"; User_in.Attributes = new TAttribute[] { attr }; User_update.Path = path + alias; User_update.Password = "******"; User_update.Name = "Hans Hanssen"; User_update.EMail = "*****@*****.**"; // IMPORTANT!!! // .NET has the terrible behavior, to set all boolean and numeric value that are not // defined to "false" resp. "0" // So if you update an object and do not set the "IsVisible" flag, it will set the object to // invisible!!! User_update.DeleteConfirmation = true; TAddressNamed bill_update = new TAddressNamed(); bill_update.FirstName = "Hans"; bill_update.LastName = "Hanssen"; bill_update.Street = "Musterstraße 2b"; bill_update.CodePorte = "uvwxyz"; bill_update.Birthday = new DateTime(1976, 9, 25, 11, 33, 0); User_update.BillingAddress = bill_update; TAddressNamed ship1_update = new TAddressNamed(); ship1_update.Alias = "ship1"; ship1_update.FirstName = "Klaus"; ship1_update.LastName = "Klaussen44"; ship1_update.Street = "Musterstraße 44"; ship1_update.EMail = "*****@*****.**"; ship1_update.Birthday = new DateTime(1976, 9, 25, 11, 33, 0); TAddressNamed ship3_update = new TAddressNamed(); ship3_update.Alias = "ship3"; ship3_update.FirstName = "Klaus"; ship3_update.LastName = "Klaussen33"; ship3_update.Street = "Musterstraße 33"; ship3_update.EMail = "*****@*****.**"; ship3_update.Birthday = new DateTime(1976, 9, 25, 11, 33, 0); TAddressNamed[] addresses_update = new TAddressNamed[] { ship1_update, ship3_update, }; User_update.AdditionalAddresses = addresses_update; TAttribute attr_update = new TAttribute(); attr_update.Name = "ChallengePhrase"; attr_update.Value = "my updated challenge phrase"; User_update.Attributes = new TAttribute[] { attr_update }; }
public void Init() { // initialize orderService orderService = new OrderService(); orderService.Credentials = new System.Net.NetworkCredential(WEBSERVICE_LOGIN, WEBSERVICE_PASSWORD); orderService.PreAuthenticate = true; orderService.Url = WEBSERVICE_URL; // initialize addresses TAddressNamed Address_in = new TAddressNamed(); Address_in.EMail = "*****@*****.**"; Address_in.FirstName = "Klaus"; Address_in.LastName = "Klaussen"; Address_in.Street = "Musterstraße 2"; Address_in.Street2 = "Ortsteil Niederfingeln"; TAttribute jobTitle= new TAttribute(); jobTitle.Name="JobTitle"; jobTitle.Value="best Job"; TAttribute salutation = new TAttribute(); salutation.Name="Salutation"; salutation.Value="Dr."; Address_in.Attributes = new TAttribute[]{jobTitle,salutation}; TAddressNamed Address_up = new TAddressNamed(); Address_up.FirstName = "Hans"; Address_up.LastName = "Hanssen"; Address_up.Street = "Musterstraße 2b"; Address_up.Street2 = "Ortsteil Oberfingeln"; //initialize order input data Order_in.Alias = alias; Order_in.Customer = customer; Order_in.BillingAddress = Address_in; Order_in.CreationDate = new DateTime(2006, 1, 1, 12, 0, 0, DateTimeKind.Local); Order_in.ViewedOn = new DateTime(2006, 1, 1, 23, 59, 0, DateTimeKind.Local); Order_in.ViewedOnSpecified = true; TAttribute OrderAttr_in = new TAttribute(); OrderAttr_in.Name = "Comment"; OrderAttr_in.Value="my order comment"; Order_in.Attributes = new TAttribute[] { OrderAttr_in }; TProductLineItemIn Product_in = new TProductLineItemIn(); Product_in.Product = "/Shops/DemoShop/Products/ho_1112105010"; Product_in.Quantity = 10; TLineItemContainerIn lineItemContainer = new TLineItemContainerIn(); lineItemContainer.CurrencyID = "EUR"; lineItemContainer.PaymentMethod = "/Shops/DemoShop/PaymentMethods/Invoice"; lineItemContainer.ShippingMethod = "/Shops/DemoShop/ShippingMethods/Express"; lineItemContainer.TaxArea = "/TaxMatrixGermany/EU"; lineItemContainer.TaxModel = "gross"; lineItemContainer.ProductLineItems = new TProductLineItemIn[]{Product_in}; Order_in.LineItemContainer = lineItemContainer; //initialize order update data Order_up.Path = path; Order_up.BillingAddress = Address_up; Order_up.InProcessOn = new DateTime(2006, 1, 2, 0, 0, 0, DateTimeKind.Local); Order_up.InProcessOnSpecified = true; TAttribute OrderAttr_up = new TAttribute(); OrderAttr_up.Name = "Comment"; OrderAttr_up.Value = "my updated order comment"; Order_up.Attributes = new TAttribute[] { OrderAttr_up }; }