Esempio n. 1
0
        private void FirstPartner(string connectionString, Partner partner)
        {
            PartnerController partnerController = new PartnerController();

            partnerController.AndroAdminConnectionStringOverride = connectionString;

            // Add a partner
            ActionResult actionResult = partnerController.Add(partner);

            // Check for model errors
            string error = AndroAdminTestHelper.CheckForModelError(actionResult, partnerController);

            if (error.Length > 0)
            {
                Assert.Fail(error);
            }

            // Check to see if the partner exists
            error = AndroAdminTestHelper.CheckPartners(partnerController, new List <Partner> {
                partner
            });

            if (error.Length > 0)
            {
                Assert.Fail(error);
            }

            SyncHelper.ConnectionStringOverride = connectionString;
            string xml          = "";
            string errorMessage = AndroAdminSyncHelper.TryGetExportSyncXml(2, 3, out xml);

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

            string expectedXml2 =
                "<CloudSync>" +
                "<FromDataVersion>2</FromDataVersion>" +
                "<ToDataVersion>3</ToDataVersion>" +
                "<Stores />" +
                "<Partners>" +
                "<Partner>" +
                "<Id>1</Id>" +
                "<Name>test partner 1</Name>" +
                "<ExternalId>testpartner1</ExternalId>" +
                "<Applications />" +
                "</Partner>" +
                "</Partners>" +
                "</CloudSync>";

            Assert.AreEqual <string>(expectedXml2, xml, "Incorrect sync xml generated: " + xml);
        }
Esempio n. 2
0
        private void RemoveFirstPartnerApplicationStore(string connectionString, ACSApplicationModel application)
        {
            PartnerController partnerController = new PartnerController();

            partnerController.AndroAdminConnectionStringOverride = connectionString;

            // Remove the first store
            application.Stores[0].Selected = false;

            // Remove the first store from the application
            ActionResult actionResult = partnerController.ApplicationStores(application);

            // Check for model errors
            string error = AndroAdminTestHelper.CheckForModelError(actionResult, partnerController);

            if (error.Length > 0)
            {
                Assert.Fail(error);
            }

            // Check to see if the partner exists
            error = AndroAdminTestHelper.CheckPartners(partnerController, new List <Partner> {
                application.Partner
            });

            if (error.Length > 0)
            {
                Assert.Fail(error);
            }

            // Check to see if the application exists
            error = AndroAdminTestHelper.CheckPartnerApplications(partnerController, application.Partner, new List <ACSApplicationModel> {
                application
            });

            if (error.Length > 0)
            {
                Assert.Fail(error);
            }

            SyncHelper.ConnectionStringOverride = connectionString;
            string xml          = "";
            string errorMessage = AndroAdminSyncHelper.TryGetExportSyncXml(6, 7, out xml);

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

            string expectedXml2 =
                "<CloudSync>" +
                "<FromDataVersion>6</FromDataVersion>" +
                "<ToDataVersion>7</ToDataVersion>" +
                "<Stores />" +
                "<Partners>" +
                "<Partner>" +
                "<Id>1</Id>" +
                "<Name>test partner 1</Name>" +
                "<ExternalId>testpartner1</ExternalId>" +
                "<Applications>" +
                "<Application>" +
                "<Id>1</Id>" +
                "<ExternalApplicationId>TestExternalApplicationid</ExternalApplicationId>" +
                "<Name>TestName</Name>" +
                "<Sites>" +
                "123" +
                "</Sites>" +
                "</Application>" +
                "</Applications>" +
                "</Partner>" +
                "</Partners>" +
                "</CloudSync>";

            Assert.AreEqual <string>(expectedXml2, xml, "Incorrect sync xml generated: " + xml);
        }