public void UpdateSupplier_creates_new_supplier_and_returns_ok()
        {
            Supplier newSupplier = new AnonymousSupplierBuilder().build();

            string result = WebMethods.SupplierMethods.UpdateSupplier(newSupplier);

            result = XElement.Parse(result).Value;

            Assert.IsTrue(result == "ok",
                          string.Format("Supplier with id {0} could not be created/updated. Unexpected return value: {1}", newSupplier.Id, result));
        }
        public void DeleteSupplierById_with_valid_id_returns_ok()
        {
            Supplier supplier = new AnonymousSupplierBuilder().build();

            string result = WebMethods.SupplierMethods.UpdateSupplier(supplier);

            result = XElement.Parse(result).Value;
            Assert.IsTrue(result == "ok",
                          string.Format("Supplier with id {0} could not be created/updated. Unexpected return value: {1}", supplier.Id, result));

            result = WebMethods.SupplierMethods.DeleteSupplierById(supplier.Id);
            result = XElement.Parse(result).Value;
            Assert.IsTrue(result == "ok",
                          string.Format("Supplier with id {0} could not be deleted. Unexpected return value: {1}", supplier.Id, result));
        }
        public void UpdateSupplier_with_values_saves_all_data_correctly()
        {
            Supplier supplier = new AnonymousSupplierBuilder().build();

            //save the supplier to the webshop
            string result = WebMethods.SupplierMethods.UpdateSupplier(supplier);

            result = XElement.Parse(result).Value;

            Assert.IsTrue(result == "ok",
                          string.Format("Supplier with id {0} could not be created/updated. Unexpected return value was: {1}", supplier.Id, result));

            //retrieve the supplier from the webshop
            string   errorMsg;
            Supplier supplierFromWS = WebMethods.SupplierMethods.GetSupplierById(supplier.Id, out errorMsg);

            //compare all values
            Assert.AreEqual(supplier.Id, supplierFromWS.Id, "The field comparison for field \"id\" failed.");
            Assert.AreEqual(supplier.Name, supplierFromWS.Name, "The field comparison for field \"name\" failed.");
            Assert.AreEqual(supplier.Test, supplierFromWS.Test, "The field comparison for field \"test\" failed.");
            Assert.AreEqual(supplier.CreatedDttm, supplierFromWS.CreatedDttm, "The field comparison for field \"created\" failed.");
            Assert.AreEqual(supplier.UpdatedDttm, supplierFromWS.UpdatedDttm, "The field comparison for field \"updated\" failed.");
            Assert.AreEqual(supplier.DeletedDttm, supplierFromWS.DeletedDttm, "The field comparison for field \"deleted\" failed.");
        }