RegisterViewModels() static private method

static private RegisterViewModels ( ) : void
return void
Ejemplo n.º 1
0
        static TestFixture()
        {
            // TODO: Retrieve Localization Info from CM (?)

            _parentLocalization = new Localization
            {
                Id   = "1065",
                Path = "/autotest-parent"
            };

            _childLocalization = new Localization
            {
                Id   = "1078",
                Path = "/autotest-child"
            };

            _legacyParentLocalization = new Localization
            {
                Id   = "1081",
                Path = "/autotest-parent-legacy"
            };

            _legacyChildLocalization = new Localization
            {
                Id   = "1083",
                Path = "/autotest-child-legacy"
            };

            _testLocalizations = new[] { _parentLocalization, _childLocalization, _legacyParentLocalization, _legacyChildLocalization };

            TestRegistration.RegisterViewModels();
        }
Ejemplo n.º 2
0
        static TestFixture()
        {
            /* dxadevwev85.ams.dev
             * _parentLocalization = new Localization
             * {
             *  Id = "1065",
             *  Path = "/autotest-parent"
             * };
             *
             * _childLocalization = new Localization
             * {
             *  Id = "1078",
             *  Path = "/autotest-child"
             * };
             *
             * _legacyParentLocalization = new Localization
             * {
             *  Id = "1081",
             *  Path = "/autotest-parent-legacy"
             * };
             *
             * _legacyChildLocalization = new Localization
             * {
             *  Id = "1083",
             *  Path = "/autotest-child-legacy"
             * }; */

            _parentLocalization = new Localization
            {
                Path = "/autotest-parent"
            };

            _childLocalization = new Localization
            {
                Path = "/autotest-child"
            };

            _legacyParentLocalization = new Localization
            {
                Path = "/autotest-parent-legacy"
            };

            _legacyChildLocalization = new Localization
            {
                Path = "/autotest-child-legacy"
            };

            _testLocalizations = new[]
            {
                _parentLocalization, _childLocalization, _legacyParentLocalization,
                _legacyChildLocalization
            };

            // map path of publications to Ids
            var client       = ApiClientFactory.Instance.CreateClient();
            var publications = client.GetPublications(ContentNamespace.Sites, null, null, null, null);

            Assert.AreNotEqual(0, publications.Edges.Count,
                               "No publications returned from content service. Check you have published all the relevant publications.");
            var publicationsLut = new Dictionary <string, string>();

            foreach (var x in publications.Edges.Where(x => !publicationsLut.ContainsKey(x.Node.PublicationUrl)))
            {
                publicationsLut.Add(x.Node.PublicationUrl, x.Node.PublicationId.ToString());
            }
            foreach (var x in _testLocalizations)
            {
                if (!publicationsLut.ContainsKey(x.Path))
                {
                    continue;
                }
                x.Id = publicationsLut[x.Path];
                if (x.Path != "/autotest-parent")
                {
                    continue;
                }
                // Grab homepage id since this is used in some unit tests
                int    pubId = int.Parse(x.Id);
                string path  = $"{x.Path}/index.html";
                var    page  = client.GetPage(
                    ContentNamespace.Sites, pubId, path, null,
                    ContentIncludeMode.Exclude, null);
                if (page == null)
                {
                    Assert.Fail("Unable to find /autotest-parent homepage Id");
                }
                HomePageId = page.ItemId.ToString();
            }
            TestRegistration.RegisterViewModels();
        }