public void UpdateCustomer_with_nulls_saves_all_data_correctly() { var customer = new Customer(); customer.StoreId = ARandom.IntBetween(1000000, int.MaxValue); customer.LastName = ARandom.LastName(); customer.Email = "archive+" + ARandom.StringFromCharacterSet(15, "abcdefghijklmnopqrstuvwxyz").TrimEnd() + "@animatomusic.be"; customer.Test = true; //save the customer to the webshop string result = WebMethods.CustomerMethods.UpdateCustomer(customer); result = XElement.Parse(result).Value; Assert.IsTrue(result == "ok", string.Format("Customer with store_id {0} could not be created/updated. Unexpected return value was: {1}", customer.StoreId, result)); //retrieve the customer from the webshop string errorMsg; Customer customerFromWS = WebMethods.CustomerMethods.GetCustomerByStoreId((int)customer.StoreId, out errorMsg); //compare all values Assert.AreEqual(customer.StoreId, customerFromWS.StoreId, "The field comparison for field \"store_id\" failed."); Assert.AreEqual(customer.LastName, customerFromWS.LastName, "The field comparison for field \"last_name\" failed."); Assert.AreEqual(customer.FirstName, customerFromWS.FirstName, "The field comparison for field \"first_name\" failed."); Assert.AreEqual(customer.ShippingAddressStreet, customerFromWS.ShippingAddressStreet, "The field comparison for field \"shipping_address_street\" failed."); Assert.AreEqual(customer.ShippingAddressHomeNumber, customerFromWS.ShippingAddressHomeNumber, "The field comparison for field \"shipping_address_home_number\" failed."); Assert.AreEqual(customer.ShippingAddressZip, customerFromWS.ShippingAddressZip, "The field comparison for field \"shipping_address_zip\" failed."); Assert.AreEqual(customer.ShippingAddressCity, customerFromWS.ShippingAddressCity, "The field comparison for field \"shipping_address_city\" failed."); Assert.AreEqual(customer.ShippingAddressCountry, customerFromWS.ShippingAddressCountry, "The field comparison for field \"shipping_address_country\" failed."); Assert.AreEqual(customer.Phone, customerFromWS.Phone, "The field comparison for field \"phone\" failed."); Assert.AreEqual(customer.Mobile, customerFromWS.Mobile, "The field comparison for field \"mobile\" failed."); Assert.AreEqual(customer.Email, customerFromWS.Email, "The field comparison for field \"email\" failed."); Assert.AreEqual(customer.BillingName, customerFromWS.BillingName, "The field comparison for field \"billing_name\" failed."); Assert.AreEqual(customer.BillingContact, customerFromWS.BillingContact, "The field comparison for field \"billing_contact\" failed."); Assert.AreEqual(customer.BillingAddress1, customerFromWS.BillingAddress1, "The field comparison for field \"billing_address1\" failed."); Assert.AreEqual(customer.BillingAddress2, customerFromWS.BillingAddress2, "The field comparison for field \"billing_address2\" failed."); Assert.AreEqual(customer.BillingAddress3, customerFromWS.BillingAddress3, "The field comparison for field \"billing_address3\" failed."); Assert.AreEqual(customer.VatNumber, customerFromWS.VatNumber, "The field comparison for field \"vat_number\" failed."); Assert.AreEqual(customer.WebshopDiscount6, customerFromWS.WebshopDiscount6, "The field comparison for field \"std_discount_for_tax_rate_id1\" failed."); Assert.AreEqual(customer.WebshopDiscount21, customerFromWS.WebshopDiscount21, "The field comparison for field \"std_discount_for_tax_rate_id2\" failed."); Assert.AreEqual(customer.IsTeacher, customerFromWS.IsTeacher, "The field comparison for field \"is_teacher\" failed."); Assert.AreEqual(customer.IsReseller, customerFromWS.IsReseller, "The field comparison for field \"is_reseller\" failed."); Assert.AreEqual(customer.Institution, customerFromWS.Institution, "The field comparison for field \"institution\" failed."); Assert.AreEqual(customer.TeachingSubjects, customerFromWS.TeachingSubjects, "The field comparison for field \"teaching_subjects\" failed."); Assert.AreEqual(customer.TeacherCardNumber, customerFromWS.TeacherCardNumber, "The field comparison for field \"card_number\" failed."); Assert.AreEqual(customer.TeacherCardValidFrom, customerFromWS.TeacherCardValidFrom, "The field comparison for field \"card_valid_from\" failed."); Assert.AreEqual(customer.TeacherCardValidTo, customerFromWS.TeacherCardValidTo, "The field comparison for field \"card_valid_to\" failed."); Assert.AreEqual(customer.TeacherRegistrationNote, customerFromWS.TeacherRegistrationNote, "The field comparison for field \"teacher_registration_note\" failed."); Assert.AreEqual(customer.TeacherConfirmed, customerFromWS.TeacherConfirmed, "The field comparison for field \"teacher_confirmed\" failed."); Assert.AreEqual(customer.LastLoginDttm, customerFromWS.LastLoginDttm, "The field comparison for field \"last_login\" failed."); Assert.AreEqual(customer.Test, customerFromWS.Test, "The field comparison for field \"test\" failed."); //CreatedDttm and UpdateDttm should not be compared, because upon creation of a customer in the webshop, both fields will be set if no value is provided //Assert.AreEqual(customer.CreatedDttm, customerFromWS.CreatedDttm, "The field comparison for field \"created\" failed."); //Assert.AreEqual(customer.UpdatedDttm, customerFromWS.UpdatedDttm, "The field comparison for field \"updated\" failed."); Assert.AreEqual(customer.DeletedDttm, customerFromWS.DeletedDttm, "The field comparison for field \"deleted\" failed."); }
public AnonymousCustomerBuilder() { SetProperty(x => x.StoreId, ARandom.IntBetween(1000000, int.MaxValue)); //SetProperty(x => x.WebshopId, ARandom.IntBetween(1000000, int.MaxValue)); SetProperty(x => x.LastName, "Test_" + ARandom.LastName()); SetProperty(x => x.FirstName, "Test_" + ARandom.FirstName()); SetProperty(x => x.ShippingAddressStreet, "Test_" + ARandom.Text(15).TrimEnd()); SetProperty(x => x.ShippingAddressHomeNumber, ARandom.Text(5).TrimEnd()); SetProperty(x => x.ShippingAddressCity, ARandom.City()); SetProperty(x => x.ShippingAddressZip, ARandom.ZipCode()); SetProperty(x => x.ShippingAddressState, ""); SetProperty(x => x.ShippingAddressCountryId, (int?)ARandom.EnumValue <Enums.Country>()); SetProperty(x => x.ShippingAddressCountry, Enum.GetName(typeof(Enums.Country), ARandom.EnumValue <Enums.Country>())); SetProperty(x => x.Phone, ARandom.StringPattern("##/### ## ##")); SetProperty(x => x.Mobile, ARandom.StringPattern("####/## ## ##")); SetProperty(x => x.Email, "archive+" + ARandom.StringFromCharacterSet(15, "abcdefghijklmnopqrstuvwxyz").TrimEnd() + "@animatomusic.be"); SetProperty(x => x.BillingAddress1, ARandom.Text(15).TrimEnd()); SetProperty(x => x.BillingAddress2, ARandom.Text(15).TrimEnd()); SetProperty(x => x.BillingAddress3, ARandom.Text(15).TrimEnd()); SetProperty(x => x.BillingName, ARandom.Text(30).TrimEnd()); SetProperty(x => x.BillingContact, ARandom.Text(30).TrimEnd()); SetProperty(x => x.VatNumber, ARandom.Text(15).TrimEnd()); SetProperty(x => x.WebshopDiscount6, (byte)ARandom.IntBetween(0, 100)); SetProperty(x => x.WebshopDiscount21, (byte)ARandom.IntBetween(0, 100)); SetProperty(x => x.IsTeacher, ARandom.Boolean()); SetProperty(x => x.IsReseller, ARandom.Boolean()); SetProperty(x => x.Institution, ARandom.Text(50).TrimEnd()); SetProperty(x => x.TeacherCardNumber, "17511240450-000010"); SetProperty(x => x.TeacherCardValidFrom, ARandom.DateAfter(DateTime.Today)); SetProperty(x => x.TeacherCardValidTo, ARandom.DateAfter(DateTime.Today)); SetProperty(x => x.TeacherRegistrationNote, ARandom.Text(150).TrimEnd()); SetProperty(x => x.TeacherConfirmed, ARandom.DateTime()); SetProperty(x => x.TeachingSubjects, ARandom.Text(50).TrimEnd()); SetProperty(x => x.Test, true); SetProperty(x => x.CreatedDttm, ARandom.DateTimeInPast()); SetProperty(x => x.UpdatedDttm, ARandom.DateTimeInPast()); SetProperty(x => x.DeletedDttm, (DateTime?)null); }
public void should_fail_if_characterset_is_empty() { Catch.Exception(() => ARandom.StringFromCharacterSet(10, "")).Should().BeOfType <ArgumentNullException>(); }
public When_generating_a_random_string_constrained_to_a_specific_set_of_characters() { _string = ARandom.StringFromCharacterSet(10, "ABC123"); }