예제 #1
0
        public void GetAccount_ValidHandle()
        {
            using (WCFServiceTestSettings settings = new WCFServiceTestSettings())
            {
                string handle = "";
                settings.Client.OpenWebOrder(out handle);
                DTO_WebOrderAccount account = settings.CreateAccountSection();
                var response = settings.Client.SaveIncompleteOrderAccountSection(handle, account);
                DTO_WebOrderAccount accountPart = new DTO_WebOrderAccount();
                settings.Client.RetrieveIncompleteOrderAccountSection(out accountPart, handle);

                Assert.AreEqual(account.Comments.Length, accountPart.Comments.Length);
                Assert.AreEqual(account.Covers, accountPart.Covers);
                Assert.AreEqual(account.Delivery.City, accountPart.Delivery.City);
                Assert.AreEqual(account.Delivery.Country, accountPart.Delivery.Country);
                Assert.AreEqual(account.Delivery.Note, accountPart.Delivery.Note);
                Assert.AreEqual(account.Delivery.Phone, accountPart.Delivery.Phone);
                Assert.AreEqual(account.Delivery.Recipient, accountPart.Delivery.Recipient);
                Assert.AreEqual(account.Delivery.StreetName, accountPart.Delivery.StreetName);
                Assert.AreEqual(account.Delivery.StreetNo, accountPart.Delivery.StreetNo);
                Assert.AreEqual(account.Delivery.Suburb, accountPart.Delivery.Suburb);
                Assert.AreEqual(account.MemberNumber, accountPart.MemberNumber);
                Assert.AreEqual(account.Name, accountPart.Name);
                Assert.AreEqual(account.OrderItems.Length, accountPart.OrderItems.Length);
                Assert.AreEqual(account.Payments.PaymentRequired, accountPart.Payments.PaymentRequired);
            }
        }
예제 #2
0
 public void CommitOrder_InvalidHandle()
 {
     using (WCFServiceTestSettings settings = new WCFServiceTestSettings())
     {
         string handle   = "ABC";
         var    response = settings.Client.CommitOrder(handle);
         Assert.IsFalse(response.Succesful);
     }
 }
예제 #3
0
 public void OpenOrder()
 {
     using (WCFServiceTestSettings settings = new WCFServiceTestSettings())
     {
         string handle = "";
         settings.Client.OpenWebOrder(out handle);
         Assert.IsTrue(!string.IsNullOrEmpty(handle));
     }
 }
예제 #4
0
 public void GetHeader_InvalidHandle()
 {
     using (WCFServiceTestSettings settings = new WCFServiceTestSettings())
     {
         string             handle = "e6a9bb54-da25-102b-9a03-2db401e887ec";
         DTO_WebOrderHeader header = new DTO_WebOrderHeader();
         var response = settings.Client.RetrieveIncompleteOrderHeaderSection(out header, handle);
         Assert.IsFalse(response.Succesful);
     }
 }
예제 #5
0
 public void SaveFrom_InvalidHandle()
 {
     using (WCFServiceTestSettings settings = new WCFServiceTestSettings())
     {
         string           handle = "e6a9bb54-da25-102b-9a03-2db401e887ec";
         DTO_WebOrderFrom from   = settings.CreateFromSection();
         var response            = settings.Client.SaveIncompleteOrderFromSection(handle, from);
         Assert.IsFalse(response.Succesful);
     }
 }
예제 #6
0
 public void GetStatus_InvalidHandle()
 {
     using (WCFServiceTestSettings settings = new WCFServiceTestSettings())
     {
         string         handle   = "e6a9bb54-da25-102b-9a03-2db401e887ec";
         WebOrderStatus status   = WebOrderStatus.Unknown;
         var            response = settings.Client.GetCommittedWebOrderStatus(out status, settings.siteName, settings.storeName, handle);
         Assert.AreEqual(status, WebOrderStatus.Committed);
     }
 }
예제 #7
0
 public void SaveFrom_ValidHandle()
 {
     using (WCFServiceTestSettings settings = new WCFServiceTestSettings())
     {
         string handle = "";
         settings.Client.OpenWebOrder(out handle);
         DTO_WebOrderFrom from = settings.CreateFromSection();
         var response          = settings.Client.SaveIncompleteOrderFromSection(handle, from);
         Assert.IsTrue(response.Succesful);
     }
 }
예제 #8
0
 public void GetStatus_Incomplete()
 {
     using (WCFServiceTestSettings settings = new WCFServiceTestSettings())
     {
         string handle = "";
         settings.Client.OpenWebOrder(out handle);
         WebOrderStatus status   = WebOrderStatus.Unknown;
         var            response = settings.Client.GetCommittedWebOrderStatus(out status, settings.siteName, settings.storeName, handle);
         Assert.IsTrue(response.Succesful);
         Assert.AreEqual(status, WebOrderStatus.Incomplete);
     }
 }
예제 #9
0
        public void GetFrom_ValidHandle()
        {
            using (WCFServiceTestSettings settings = new WCFServiceTestSettings())
            {
                string handle = "";
                settings.Client.OpenWebOrder(out handle);
                DTO_WebOrderFrom from     = settings.CreateFromSection();
                var response              = settings.Client.SaveIncompleteOrderFromSection(handle, from);
                DTO_WebOrderFrom fromPart = new DTO_WebOrderFrom();
                settings.Client.RetrieveIncompleteOrderFromSection(out fromPart, handle);

                Assert.AreEqual(from.SiteID, fromPart.SiteID);
                Assert.AreEqual(from.SiteName, fromPart.SiteName);
            }
        }
예제 #10
0
        public void CommitOrder_EmptyItems()
        {
            using (WCFServiceTestSettings settings = new WCFServiceTestSettings())
            {
                string handle = "";
                settings.Client.OpenWebOrder(out handle);
                settings.Client.SaveIncompleteOrderHeaderSection(handle, settings.CreateHeaderSection());
                settings.Client.SaveIncompleteOrderFromSection(handle, settings.CreateFromSection());
                DTO_WebOrderAccount account = settings.CreateAccountSection();
                account.OrderItems = new DTO_WebOrderItem[] {};
                settings.Client.SaveIncompleteOrderAccountSection(handle, account);
                var response = settings.Client.CommitOrder(handle);

                Assert.IsFalse(response.Succesful);
            }
        }
예제 #11
0
        public void CommitOrder_InvalidSiteName()
        {
            using (WCFServiceTestSettings settings = new WCFServiceTestSettings())
            {
                string handle = "";
                settings.Client.OpenWebOrder(out handle);
                settings.Client.SaveIncompleteOrderHeaderSection(handle, settings.CreateHeaderSection());
                DTO_WebOrderFrom from = settings.CreateFromSection();
                from.SiteName = "";
                settings.Client.SaveIncompleteOrderFromSection(handle, from);
                settings.Client.SaveIncompleteOrderAccountSection(handle, settings.CreateAccountSection());
                var response = settings.Client.CommitOrder(handle);

                Assert.IsFalse(response.Succesful);
            }
        }
예제 #12
0
        public void GetStatus_Accepted()
        {
            using (WCFServiceTestSettings settings = new WCFServiceTestSettings())
            {
                string handle = "";
                settings.Client.OpenWebOrder(out handle);
                settings.Client.SaveIncompleteOrderHeaderSection(handle, settings.CreateHeaderSection());
                settings.Client.SaveIncompleteOrderFromSection(handle, settings.CreateFromSection());
                settings.Client.SaveIncompleteOrderAccountSection(handle, settings.CreateAccountSection());
                settings.Client.CommitOrder(handle);

                WebOrderStatus status   = WebOrderStatus.Unknown;
                var            response = settings.Client.GetCommittedWebOrderStatus(out status, settings.siteName, settings.storeName, handle);
                Assert.IsTrue(response.Succesful);
                Assert.AreEqual(status, WebOrderStatus.Accepted);
            }
        }
예제 #13
0
        public void GetHeader_ValidHandle()
        {
            using (WCFServiceTestSettings settings = new WCFServiceTestSettings())
            {
                string handle = "";
                settings.Client.OpenWebOrder(out handle);
                DTO_WebOrderHeader header = settings.CreateHeaderSection();
                var response = settings.Client.SaveIncompleteOrderHeaderSection(handle, header);
                DTO_WebOrderHeader headerPart = new DTO_WebOrderHeader();
                settings.Client.RetrieveIncompleteOrderHeaderSection(out headerPart, handle);

                Assert.AreEqual(header.StoreName, headerPart.StoreName);
                Assert.AreEqual(header.Scheduled, headerPart.Scheduled);
                Assert.AreEqual(header.Respond, headerPart.Respond);
                Assert.AreEqual(header.OrderTotal, headerPart.OrderTotal);
                Assert.AreEqual(header.OrderDate.ToShortDateString(), headerPart.OrderDate.ToShortDateString());
                Assert.AreEqual(header.ExpectedDate.ToShortDateString(), headerPart.ExpectedDate.ToShortDateString());
            }
        }