Esempio n. 1
0
        public void SecondStore()
        {
            string syncXml =
                "<CloudSync>" +
                "<FromDataVersion>7</FromDataVersion>" +
                "<ToDataVersion>8</ToDataVersion>" +
                "<Stores>" +
                "<Store>" +
                "<ExternalSiteName>Test2ExternalSiteName</ExternalSiteName>" +
                "<AndromedaSiteId>124</AndromedaSiteId>" +
                "<ExternalSiteId>Test2ExternalSiteId</ExternalSiteId>" +
                "<StoreStatus>Live</StoreStatus>" +
                "<TimeZone>GMT+4</TimeZone>" +
                "<Phone>2222222</Phone>" +
                "<Address>" +
                "<Id>2</Id>" +
                "<Org1>Test2_Org1</Org1>" +
                "<Org2>Test2_Org2</Org2>" +
                "<Org3>Test2_Org3</Org3>" +
                "<Prem1>Test2_Prem1</Prem1>" +
                "<Prem2>Test2_Prem2</Prem2>" +
                "<Prem3>Test2_Prem3</Prem3>" +
                "<Prem4>Test2_Prem4</Prem4>" +
                "<Prem5>Test2_Prem5</Prem5>" +
                "<Prem6>Test2_Prem6</Prem6>" +
                "<RoadNum>Test2_RoadNum</RoadNum>" +
                "<RoadName>Test2_RoadName</RoadName>" +
                "<Locality>Test2_Locality</Locality>" +
                "<Town>Test2_Town</Town>" +
                "<County>Test2_County</County>" +
                "<State>Test2_State</State>" +
                "<PostCode>Test2_PostCode</PostCode>" +
                "<DPS>DPS2</DPS>" +
                "<Lat>2.111</Lat>" +
                "<Long>4.333</Long>" +
                "<CountryId>234</CountryId>" +
                "</Address>" +
                "</Store>" +
                "</Stores>" +
                "<Partners />" +
                "</CloudSync>";

            string errorMessage = AcsSyncHelper.ImportSyncXml(syncXml);

            Assert.AreEqual <string>("", errorMessage);

            // Get the store (we need the id)
            ISiteDataAccess siteDataAccess = new SitesDataAccess();

            if (SyncHelper.ConnectionStringOverride != null)
            {
                siteDataAccess.ConnectionStringOverride = SyncHelper.ConnectionStringOverride;
            }
            AndroCloudDataAccess.Domain.Site site = null;

            siteDataAccess.GetByExternalSiteId("Test2ExternalSiteId", out site);

            Assert.IsNotNull(site, "Site not found");

            // Create a fake menu for the store
            IDataAccessFactory dataAccessFactory = new EntityFrameworkDataAccessFactory()
            {
                ConnectionStringOverride = SyncHelper.ConnectionStringOverride
            };
            string sourceId = "";

            MenuService.Post(site.AndroId.ToString(), "A24C92FE-92D1-4705-8E33-202F51BCE38D", "testhardwarekey", "1", "testmenu", DataTypeEnum.XML, dataAccessFactory, out sourceId);
        }
Esempio n. 2
0
        public void DeleteFirstPartnerApplicationStore(string connectionString)
        {
            string syncXml =
                "<CloudSync>" +
                "<FromDataVersion>9</FromDataVersion>" +
                "<ToDataVersion>10</ToDataVersion>" +
                "<Stores />" +
                "<Partners>" +
                "<Partner>" +
                "<Id>1</Id>" +
                "<Name>test partner 1AAA</Name>" +
                "<ExternalId>testpartner1AAA</ExternalId>" +
                "<Applications>" +
                "<Application>" +
                "<Id>1</Id>" +
                "<ExternalApplicationId>TestExternalApplicationidAAA</ExternalApplicationId>" +
                "<Name>TestNameAAA</Name>" +
                "<Sites>124</Sites>" +
                "</Application>" +
                "</Applications>" +
                "</Partner>" +
                "</Partners>" +
                "</CloudSync>";

            string errorMessage = AcsSyncHelper.ImportSyncXml(syncXml);

            Assert.AreEqual <string>("", errorMessage);

            IDataAccessFactory dataAccess = new EntityFrameworkDataAccessFactory()
            {
                ConnectionStringOverride = connectionString
            };
            string sourceId = "";

            // Expected site list xml
            //string expectedSiteListXml =
            //    "<Sites>" +
            //        "<Site>" +
            //            "<SiteId>TestExternalSiteIdZZZ</SiteId>" +
            //            "<Name>TestExternalSiteNameZZZ</Name>" +
            //            "<MenuVersion>1</MenuVersion>" +
            //            "<IsOpen>false</IsOpen>" +
            //            "<EstDelivTime>0</EstDelivTime>" +
            //        "</Site>" +
            //    "</Sites>";

            // Get the site list
            Response siteListResponse = SiteService.Get("TestExternalApplicationidAAA", "", "", "", null, AndroCloudHelper.DataTypeEnum.XML, dataAccess, out sourceId);

            // Parse the sites xml
            XElement xElement = XElement.Parse(siteListResponse.ResponseText);

            // Check that the correct number of sites were returned
            var actualSites = (from sites in xElement.Elements("Site")
                               select sites).ToList();

            Assert.AreEqual <int>(1, actualSites.Count);

            // Try and get the fiirst site details.  This should fail
            Response siteDetailsResponse = SiteDetailsService.Get("TestExternalApplicationidAAA", "TestExternalSiteIdZZZ", AndroCloudHelper.DataTypeEnum.XML, dataAccess, out sourceId);

            // Parse the xml
            Assert.AreEqual <string>(
                "<Error><ErrorCode>1030</ErrorCode><Message>ApplicationId is not authorized to access this siteId</Message></Error>",
                siteDetailsResponse.ResponseText);

            //// Expected site details xml
            //string expectedSite2DetailsXml =
            //    "<SiteDetails>" +
            //        "<SiteId>Test2ExternalSiteId</SiteId>" +
            //        "<Name>Test2ExternalSiteName</Name>" +
            //        "<MenuVersion>1</MenuVersion>" +
            //        "<IsOpen>false</IsOpen>" +
            //        "<EstDelivTime>0</EstDelivTime>" +
            //        "<TimeZone>GMT+4</TimeZone>" +
            //        "<Phone>2222222</Phone>" +
            //        "<Address>" +
            //            "<Long>4.333</Long>" +
            //            "<Lat>2.111</Lat>" +
            //            "<Prem1>Test2_Prem1</Prem1>" +
            //            "<Prem2>Test2_Prem2/Prem2>" +
            //            "<Prem3>Test2_Prem3</Prem3>" +
            //            "<Prem4>Test2_Prem4</Prem4>" +
            //            "<Prem5>Test2_Prem5</Prem5>" +
            //            "<Prem6>Test2_Prem6</Prem6>" +
            //            "<Org1>Test2_Org1</Org1>" +
            //            "<Org2>Test2_Org2</Org2>" +
            //            "<Org3>Test2_Org3</Org3>" +
            //            "<RoadNum>Test2_RoadNum</RoadNum>" +
            //            "<RoadName>Test2_RoadName</RoadName>" +
            //            "<Town>Test2_Town</Town>" +
            //            "<Postcode>Test2_PostCode</Postcode>" +
            //            "<Dps>DPS2</Dps>" +
            //            "<County>Test2_County</County>" +
            //            "<Locality>Test2_Locality</Locality>" +
            //            "<Country>United Kingdom</Country>" +
            //        "</Address>" +
            //        "<OpeningHours />" +
            //        "<PaymentProvider />" +
            //        "<PaymentClientId />" +
            //        "<PaymentClientPassword />" +
            //    "</SiteDetails>";

            // Get the site2 details
            siteDetailsResponse = SiteDetailsService.Get("TestExternalApplicationidAAA", "Test2ExternalSiteId", AndroCloudHelper.DataTypeEnum.XML, dataAccess, out sourceId);

            // Parse the xml
            xElement = XElement.Parse(siteDetailsResponse.ResponseText);

            // Check to see if the first site was returned
            errorMessage = XmlHelper.CheckSiteDetails(
                xElement,
                "Test2ExternalSiteId",
                "Test2ExternalSiteName",
                "GMT+4",
                "2222222",
                "4.333",
                "2.111",
                "Test2_Prem1",
                "Test2_Prem2",
                "Test2_Prem3",
                "Test2_Prem4",
                "Test2_Prem5",
                "Test2_Prem6",
                "Test2_Org1",
                "Test2_Org2",
                "Test2_Org3",
                "Test2_RoadNum",
                "Test2_RoadName",
                "Test2_Town",
                "Test2_PostCode",
                "DPS2",
                "Test2_County",
                "Test2_Locality",
                "United Kingdom");
        }
Esempio n. 3
0
        public void ModifyFirstPartnerApplication(string connectionString)
        {
            string syncXml =
                "<CloudSync>" +
                "<FromDataVersion>6</FromDataVersion>" +
                "<ToDataVersion>7</ToDataVersion>" +
                "<Stores />" +
                "<Partners>" +
                "<Partner>" +
                "<Id>1</Id>" +
                "<Name>test partner 1AAA</Name>" +
                "<ExternalId>testpartner1AAA</ExternalId>" +
                "<Applications>" +
                "<Application>" +
                "<Id>1</Id>" +
                "<ExternalApplicationId>TestExternalApplicationidAAA</ExternalApplicationId>" +
                "<Name>TestNameAAA</Name>" +
                "<Sites>123</Sites>" +
                "</Application>" +
                "</Applications>" +
                "</Partner>" +
                "</Partners>" +
                "</CloudSync>";

            string errorMessage = AcsSyncHelper.ImportSyncXml(syncXml);

            Assert.AreEqual <string>("", errorMessage);

            IDataAccessFactory dataAccess = new EntityFrameworkDataAccessFactory()
            {
                ConnectionStringOverride = connectionString
            };
            string sourceId = "";

            // Expected site list xml
            string expectedSiteListXml =
                "<Sites>" +
                "<Site>" +
                "<SiteId>TestExternalSiteIdZZZ</SiteId>" +
                "<Name>TestExternalSiteNameZZZ</Name>" +
                "<MenuVersion>1</MenuVersion>" +
                "<IsOpen>false</IsOpen>" +
                "<EstDelivTime>0</EstDelivTime>" +
                "</Site>" +
                "</Sites>";

            // Get the site list
            Response siteListResponse = SiteService.Get("TestExternalApplicationidAAA", "", "", "", null, AndroCloudHelper.DataTypeEnum.XML, dataAccess, out sourceId);

            Assert.AreEqual <string>(
                expectedSiteListXml,
                siteListResponse.ResponseText,
                "Wrong site list xml");

            // Expected site details xml
            string expectedSiteDetailsXml =
                "<SiteDetails>" +
                "<SiteId>TestExternalSiteIdZZZ</SiteId>" +
                "<Name>TestExternalSiteNameZZZ</Name>" +
                "<MenuVersion>1</MenuVersion>" +
                "<IsOpen>false</IsOpen>" +
                "<EstDelivTime>0</EstDelivTime>" +
                "<TimeZone>GMT+1</TimeZone>" +
                "<Phone>1234567890ZZZ</Phone>" +
                "<Address>" +
                "<Long>7.6</Long>" +
                "<Lat>9.8</Lat>" +
                "<Prem1>Test1_Prem1ZZZ</Prem1>" +
                "<Prem2>Test1_Prem2ZZZ</Prem2>" +
                "<Prem3>Test1_Prem3ZZZ</Prem3>" +
                "<Prem4>Test1_Prem4ZZZ</Prem4>" +
                "<Prem5>Test1_Prem5ZZZ</Prem5>" +
                "<Prem6>Test1_Prem6ZZZ</Prem6>" +
                "<Org1>Test1_Org1ZZZ</Org1>" +
                "<Org2>Test1_Org2ZZZ</Org2>" +
                "<Org3>Test1_Org3ZZZ</Org3>" +
                "<RoadNum>Test1_RoadNumZZZ</RoadNum>" +
                "<RoadName>Test1_RoadNameZZZ</RoadName>" +
                "<Town>Test1_TownZZZ</Town>" +
                "<Postcode>Test1_PostCodeZZ</Postcode>" +
                "<Dps>ZZZ1</Dps>" +
                "<County>Test1_CountyZZZ</County>" +
                "<Locality>Test1_LocalityZZZ</Locality>" +
                "<Country>United States</Country>" +
                "</Address>" +
                "<OpeningHours />" +
                "<PaymentProvider />" +
                "<PaymentClientId />" +
                "<PaymentClientPassword />" +
                "</SiteDetails>";

            // Get the site details
            Response siteDetailsResponse = SiteDetailsService.Get("TestExternalApplicationidAAA", "TestExternalSiteIdZZZ", AndroCloudHelper.DataTypeEnum.XML, dataAccess, out sourceId);

            Assert.AreEqual <string>(
                expectedSiteDetailsXml,
                siteDetailsResponse.ResponseText,
                "Wrong site details xml");
        }