Exemplo n.º 1
0
        public void InvalidManifest()
        {
            string contents = @"|||||";

            using (TemporaryPlatformManifest manifest = new TemporaryPlatformManifest(contents))
            {
                Assert.IsTrue(manifest.Manifest.ReadError);
            }
        }
Exemplo n.º 2
0
        public void SimpleValidManifest()
        {
            string contents = @"<ApplicationPlatform name=`UAP` friendlyName=`Universal Application Platform` version=`1.0.0.0` />";

            using (TemporaryPlatformManifest manifest = new TemporaryPlatformManifest(contents))
            {
                Assert.IsFalse(manifest.Manifest.ReadError);
                Assert.AreEqual("UAP", manifest.Manifest.Name);
                Assert.AreEqual("Universal Application Platform", manifest.Manifest.FriendlyName);
                Assert.AreEqual("1.0.0.0", manifest.Manifest.PlatformVersion);

                Assert.AreEqual(0, manifest.Manifest.DependentPlatforms.Count);
                Assert.AreEqual(0, manifest.Manifest.ApiContracts.Count);
            }
        }
Exemplo n.º 3
0
        public void MultipleContracts()
        {
            string contents = @"<ApplicationPlatform name=`UAP` friendlyName=`Universal Application Platform` version=`1.0.0.0`>
                                  <ContainedApiContracts>
                                    <ApiContract name=`System` version=`1.2.0.4` />
                                    <ApiContract name=`Windows.Foundation` version=`1.0.0.0` />
                                    <ApiContract name=`Windows.Foundation.OtherStuff` version=`1.5.0.0` />
                                  </ContainedApiContracts>
                                </ApplicationPlatform>";

            using (TemporaryPlatformManifest manifest = new TemporaryPlatformManifest(contents))
            {
                Assert.IsFalse(manifest.Manifest.ReadError);

                Assert.AreEqual(0, manifest.Manifest.DependentPlatforms.Count);
                Assert.AreEqual(3, manifest.Manifest.ApiContracts.Count);

                List<ApiContract> contracts = new List<ApiContract>(manifest.Manifest.ApiContracts);

                Assert.AreEqual("System", contracts[0].Name);
                Assert.AreEqual("1.2.0.4", contracts[0].Version);
                Assert.AreEqual("Windows.Foundation", contracts[1].Name);
                Assert.AreEqual("1.0.0.0", contracts[1].Version);
                Assert.AreEqual("Windows.Foundation.OtherStuff", contracts[2].Name);
                Assert.AreEqual("1.5.0.0", contracts[2].Version);
            }
        }
Exemplo n.º 4
0
        public void ContractMissingVersion()
        {
            string contents = @"<ApplicationPlatform name=`UAP` friendlyName=`Universal Application Platform` version=`1.0.0.0`>
                                  <DependentPlatform name=`UAP` version=`1.0.2.3` />
                                  <ContainedApiContracts>
                                    <ApiContract name=`System` />
                                  </ContainedApiContracts>
                                </ApplicationPlatform>";

            using (TemporaryPlatformManifest manifest = new TemporaryPlatformManifest(contents))
            {
                Assert.IsFalse(manifest.Manifest.ReadError);

                Assert.AreEqual(1, manifest.Manifest.DependentPlatforms.Count);
                PlatformManifest.DependentPlatform platform = manifest.Manifest.DependentPlatforms.First();
                Assert.AreEqual("UAP", platform.Name);
                Assert.AreEqual("1.0.2.3", platform.Version);

                Assert.AreEqual(1, manifest.Manifest.ApiContracts.Count);
                ApiContract contract = manifest.Manifest.ApiContracts.First();
                Assert.AreEqual("System", contract.Name);
                Assert.AreEqual(String.Empty, contract.Version);
            }
        }
Exemplo n.º 5
0
        public void MultipleDependentPlatforms()
        {
            string contents = @"<ApplicationPlatform name=`UAP` friendlyName=`Universal Application Platform` version=`1.0.0.0`>
                                  <DependentPlatform name=`UAP` version=`1.0.0.0` />
                                  <DependentPlatform name=`UAP` version=`1.0.2.3` />
                                  <DependentPlatform name=`MyPlatform` version=`8.8.8.8` />
                                </ApplicationPlatform>";

            using (TemporaryPlatformManifest manifest = new TemporaryPlatformManifest(contents))
            {
                Assert.IsFalse(manifest.Manifest.ReadError);

                Assert.AreEqual(0, manifest.Manifest.ApiContracts.Count);
                Assert.AreEqual(3, manifest.Manifest.DependentPlatforms.Count);

                List<PlatformManifest.DependentPlatform> platforms = new List<PlatformManifest.DependentPlatform>(manifest.Manifest.DependentPlatforms);
                Assert.AreEqual("UAP", platforms[0].Name);
                Assert.AreEqual("1.0.0.0", platforms[0].Version);
                Assert.AreEqual("UAP", platforms[1].Name);
                Assert.AreEqual("1.0.2.3", platforms[1].Version);
                Assert.AreEqual("MyPlatform", platforms[2].Name);
                Assert.AreEqual("8.8.8.8", platforms[2].Version);
            }
        }
Exemplo n.º 6
0
        public void DependentPlatformMissingName()
        {
            string contents = @"<ApplicationPlatform name=`UAP` friendlyName=`Universal Application Platform` version=`1.0.0.0`>
                                  <DependentPlatform version=`1.0.0.0` />
                                </ApplicationPlatform>";

            using (TemporaryPlatformManifest manifest = new TemporaryPlatformManifest(contents))
            {
                Assert.IsFalse(manifest.Manifest.ReadError);

                Assert.AreEqual(0, manifest.Manifest.ApiContracts.Count);
                Assert.AreEqual(1, manifest.Manifest.DependentPlatforms.Count);

                List<PlatformManifest.DependentPlatform> platforms = new List<PlatformManifest.DependentPlatform>(manifest.Manifest.DependentPlatforms);
                Assert.AreEqual(String.Empty, platforms[0].Name);
                Assert.AreEqual("1.0.0.0", platforms[0].Version);
            }
        }
Exemplo n.º 7
0
        public void VersionedContentTrueFlagReturnsTrue()
        {
            string contents = @"<ApplicationPlatform name=`UAP` friendlyName=`Universal Application Platform` version=`1.0.0.0`>
                                    <VersionedContent>True</VersionedContent>
                                </ApplicationPlatform>";

            using (TemporaryPlatformManifest manifest = new TemporaryPlatformManifest(contents))
            {
                Assert.True(manifest.Manifest.VersionedContent);
            }
        }