public void Get_method_returns_valid_xml()
        {
            int authorId = new PredefinedDataObjects().Author.Id;

            string xmlData = WebMethods.GetDataFromWebMethod("author",
                                                             "getById",
                                                             "id=" + authorId);
            string errorMsg;

            Assert.IsFalse(WebMethods.WebMethodReturnedError(xmlData, out errorMsg),
                           string.Format("Author with id {0} could not be retrieved from the webshop. Unexpected return value: {1}", authorId, errorMsg));

            string validationError = Author.ValidateXmlStructure(xmlData);

            Assert.IsNull(validationError);
        }
        public void Get_method_returns_valid_xml()
        {
            int productId = new PredefinedDataObjects().Product(Enums.ProductType.Book).Id;

            string xmlData = WebMethods.GetDataFromWebMethod("product",
                                                             "getById",
                                                             "id=" + productId);
            string errorMsg;

            Assert.IsFalse(WebMethods.WebMethodReturnedError(xmlData, out errorMsg),
                           string.Format("Product with id {0} could not be retrieved from the webshop. Unexpected return value: {1}", productId, errorMsg));

            string validationError = Product.ValidateXmlStructure(xmlData);

            Assert.IsNull(validationError);
        }
        public void Get_method_returns_valid_xml()
        {
            int countryId = (int)Enums.Country.Belgium;

            string xmlData = WebMethods.GetDataFromWebMethod("country",
                                                             "getById",
                                                             "id=" + countryId);
            string errorMsg;

            Assert.IsFalse(WebMethods.WebMethodReturnedError(xmlData, out errorMsg),
                           string.Format("Country with id {0} could not be retrieved from the webshop. Unexpected return value: {1}", countryId, errorMsg));

            string validationError = Country.ValidateXmlStructure(xmlData);

            Assert.IsNull(validationError);
        }
示例#4
0
        public void Get_method_returns_valid_xml()
        {
            int categoryId = new PredefinedDataObjects().ProductCategory.Id;

            string xmlData = WebMethods.GetDataFromWebMethod("productcategory",
                                                             "getById",
                                                             "id=" + categoryId);
            string errorMsg;

            Assert.IsFalse(WebMethods.WebMethodReturnedError(xmlData, out errorMsg),
                           string.Format("Product Category with Id {0} could not be retrieved from the webshop. Unexpected return value: {1}", categoryId, errorMsg));

            string validationError = ProductCategory.ValidateXmlStructure(xmlData);

            Assert.IsTrue(validationError == null, validationError);
        }
示例#5
0
        public void Get_method_returns_valid_xml()
        {
            int customerStoreId = (int)new PredefinedDataObjects().Customer.StoreId;

            string xmlData = WebMethods.GetDataFromWebMethod("customer",
                                                             "getByStoreId",
                                                             "id=" + customerStoreId);
            string errorMsg;

            Assert.IsFalse(WebMethods.WebMethodReturnedError(xmlData, out errorMsg),
                           string.Format("Customer with store_id {0} could not be retrieved from the webshop. Unexpected return value: {1}", customerStoreId, errorMsg));

            /*
             * Customer customer = new Customer();
             * customer.StoreId = ARandom.IntBetween(1000000, int.MaxValue);
             * customer.DeletedDttm = DateTime.Now;
             * string xmlData = customer.ToXml();
             */
            string validationError = Customer.ValidateXmlStructure(xmlData);

            Assert.IsNull(validationError);
        }