public void VerifyFrameworkSdkWithOldManifest()
        {
            string tmpRootDirectory = Path.GetTempPath();
            string frameworkPathPattern = @"Microsoft SDKs\Windows\v8.0\ExtensionSDKs\MyFramework";
            string frameworkPathPattern2 = @"ExtensionSDKs\MyFramework";

            string frameworkPath = Path.Combine(tmpRootDirectory, frameworkPathPattern);
            string manifestFile = Path.Combine(frameworkPath, "sdkManifest.xml");

            string frameworkPath2 = Path.Combine(tmpRootDirectory, frameworkPathPattern2);
            string manifestFile2 = Path.Combine(frameworkPath, "sdkManifest.xml");

            try
            {
                Directory.CreateDirectory(frameworkPath);
                Directory.CreateDirectory(frameworkPath2);

                // This is a framework SDK with specified values, no default ones are used
                string manifestExtensionSDK = @"
                <FileList
	                DisplayName = ""My SDK""
	                ProductFamilyName = ""UnitTest SDKs""
	                FrameworkIdentity = ""Name=MySDK.10.Debug, MinVersion=1.0.0.0""
                    MoreInfo = ""http://msdn.microsoft.com/MySDK""
                    MaxPlatformVersion = ""9.0""
                    MinOSVersion = ""6.2.3""
                    MaxOSVersionTested = ""6.2.2"">

                    <File Reference = ""MySDK.Sprint.winmd"" Implementation = ""XNASprintImpl.dll"">
                        <Registration Type = ""Flipper"" Implementation = ""XNASprintFlipperImpl.dll"" />
                        <Registration Type = ""Flexer"" Implementation = ""XNASprintFlexerImpl.dll"" />
                        <ToolboxItems VSCategory = ""Toolbox.Default"" />
                    </File>
                </FileList>";

                File.WriteAllText(manifestFile, manifestExtensionSDK);
                SDKManifest sdkManifest = new SDKManifest(frameworkPath);

                Assert.True(sdkManifest.FrameworkIdentities != null && sdkManifest.FrameworkIdentities.Count > 0);
                Assert.Equal(sdkManifest.MaxPlatformVersion, "9.0");
                Assert.Equal(sdkManifest.MinOSVersion, "6.2.3");
                Assert.Equal(sdkManifest.MaxOSVersionTested, "6.2.2");

                // This is a framework SDK and the values default b/c they are not in the manifest
                string manifestExtensionSDK2 = @"
                <FileList
	                DisplayName = ""My SDK""
	                ProductFamilyName = ""UnitTest SDKs""
	                FrameworkIdentity = ""Name=MySDK.10.Debug, MinVersion=1.0.0.0""
                    MoreInfo = ""http://msdn.microsoft.com/MySDK"">


                    <File Reference = ""MySDK.Sprint.winmd"" Implementation = ""XNASprintImpl.dll"">
                        <Registration Type = ""Flipper"" Implementation = ""XNASprintFlipperImpl.dll"" />
                        <Registration Type = ""Flexer"" Implementation = ""XNASprintFlexerImpl.dll"" />
                        <ToolboxItems VSCategory = ""Toolbox.Default"" />
                    </File>
                </FileList>";

                File.WriteAllText(manifestFile, manifestExtensionSDK2);
                SDKManifest sdkManifest2 = new SDKManifest(frameworkPath);

                Assert.True(sdkManifest.FrameworkIdentities != null && sdkManifest.FrameworkIdentities.Count > 0);
                Assert.Equal(sdkManifest2.MaxPlatformVersion, "8.0");
                Assert.Equal(sdkManifest2.MinOSVersion, "6.2.1");
                Assert.Equal(sdkManifest2.MaxOSVersionTested, "6.2.1");

                // This is not a framework SDK because it does not have FrameworkIdentity set
                string manifestExtensionSDK3 = @"
                <FileList
	                DisplayName = ""My SDK""
	                ProductFamilyName = ""UnitTest SDKs""
                    MoreInfo = ""http://msdn.microsoft.com/MySDK"">


                    <File Reference = ""MySDK.Sprint.winmd"" Implementation = ""XNASprintImpl.dll"">
                        <Registration Type = ""Flipper"" Implementation = ""XNASprintFlipperImpl.dll"" />
                        <Registration Type = ""Flexer"" Implementation = ""XNASprintFlexerImpl.dll"" />
                        <ToolboxItems VSCategory = ""Toolbox.Default"" />
                    </File>
                </FileList>";

                File.WriteAllText(manifestFile, manifestExtensionSDK3);
                SDKManifest sdkManifest3 = new SDKManifest(frameworkPath);

                Assert.Equal(sdkManifest3.FrameworkIdentity, null);
                Assert.Equal(sdkManifest3.MaxPlatformVersion, null);
                Assert.Equal(sdkManifest3.MinOSVersion, null);
                Assert.Equal(sdkManifest3.MaxOSVersionTested, null);

                // This is not a framework SDK because of its location
                string manifestExtensionSDK4 = @"
                <FileList
	                DisplayName = ""My SDK""
	                ProductFamilyName = ""UnitTest SDKs""
	                FrameworkIdentity = ""Name=MySDK.10.Debug, MinVersion=1.0.0.0""
                    MoreInfo = ""http://msdn.microsoft.com/MySDK""


                    <File Reference = ""MySDK.Sprint.winmd"" Implementation = ""XNASprintImpl.dll"">
                        <Registration Type = ""Flipper"" Implementation = ""XNASprintFlipperImpl.dll"" />
                        <Registration Type = ""Flexer"" Implementation = ""XNASprintFlexerImpl.dll"" />
                        <ToolboxItems VSCategory = ""Toolbox.Default"" />
                    </File>
                </FileList>";

                File.WriteAllText(manifestFile2, manifestExtensionSDK4);
                SDKManifest sdkManifest4 = new SDKManifest(frameworkPath2);

                Assert.Equal(sdkManifest4.FrameworkIdentity, null);
                Assert.Equal(sdkManifest4.MaxPlatformVersion, null);
                Assert.Equal(sdkManifest4.MinOSVersion, null);
                Assert.Equal(sdkManifest4.MaxOSVersionTested, null);

                // This is a framework SDK with partially specified values, some default values are used
                string manifestExtensionSDK5 = @"
                <FileList
	                DisplayName = ""My SDK""
	                ProductFamilyName = ""UnitTest SDKs""
	                FrameworkIdentity = ""Name=MySDK.10.Debug, MinVersion=1.0.0.0""
                    MoreInfo = ""http://msdn.microsoft.com/MySDK""
                    MaxOSVersionTested = ""6.2.2"">

                    <File Reference = ""MySDK.Sprint.winmd"" Implementation = ""XNASprintImpl.dll"">
                        <Registration Type = ""Flipper"" Implementation = ""XNASprintFlipperImpl.dll"" />
                        <Registration Type = ""Flexer"" Implementation = ""XNASprintFlexerImpl.dll"" />
                        <ToolboxItems VSCategory = ""Toolbox.Default"" />
                    </File>
                </FileList>";

                File.WriteAllText(manifestFile, manifestExtensionSDK5);
                SDKManifest sdkManifest5 = new SDKManifest(frameworkPath);

                Assert.True(sdkManifest5.FrameworkIdentities != null && sdkManifest5.FrameworkIdentities.Count > 0);
                Assert.Equal(sdkManifest5.MaxPlatformVersion, "8.0");
                Assert.Equal(sdkManifest5.MinOSVersion, "6.2.1");
                Assert.Equal(sdkManifest5.MaxOSVersionTested, "6.2.2");
            }
            finally
            {
                Directory.Delete(frameworkPath, true /* for recursive deletion */);
                Directory.Delete(frameworkPath2, true /* for recursive deletion */);
            }
        }
        public void VerifySDKManifest()
        {
            string manifestPath = Path.Combine(Path.GetTempPath(), "ManifestTmp");

            try
            {
                Directory.CreateDirectory(manifestPath);

                string manifestFile = Path.Combine(manifestPath, "sdkManifest.xml");


                string manifestPlatformSDK = @"
                <FileList
                    DisplayName = ""Windows""
                    PlatformIdentity = ""Windows, version=8.0""
                    TargetFramework = "".NETCore, version=v4.5; .NETFramework, version=v4.5""
                    MinVSVersion = ""11.0""
                    MinOSVersion = ""6.2.1""
                    MaxOSVersionTested = ""6.2.1""
                    UnsupportedDowntarget = ""Windows, version=8.0"">

                <File Reference = ""Windows"">
	                <ToolboxItems VSCategory = ""Toolbox.Default""/>
                </File>
                </FileList>";

                File.WriteAllText(manifestFile, manifestPlatformSDK);
                SDKManifest sdkManifest = new SDKManifest(manifestPath);

                Assert.Equal(sdkManifest.AppxLocations, null);
                Assert.Equal(sdkManifest.CopyRedistToSubDirectory, null);
                Assert.Equal(sdkManifest.DependsOnSDK, null);
                Assert.Equal(sdkManifest.DisplayName, "Windows");
                Assert.Equal(sdkManifest.FrameworkIdentities, null);
                Assert.Equal(sdkManifest.FrameworkIdentity, null);
                Assert.Equal(sdkManifest.MaxPlatformVersion, null);
                Assert.Equal(sdkManifest.MinVSVersion, "11.0");
                Assert.Equal(sdkManifest.MinOSVersion, "6.2.1");
                Assert.Equal(sdkManifest.PlatformIdentity, "Windows, version=8.0");
                Assert.Equal(sdkManifest.ProductFamilyName, null);
                Assert.Equal(sdkManifest.SDKType, SDKType.Unspecified);
                Assert.Equal(sdkManifest.SupportedArchitectures, null);
                Assert.Equal(sdkManifest.SupportPrefer32Bit, null);
                Assert.Equal(sdkManifest.SupportsMultipleVersions, MultipleVersionSupport.Allow);
                Assert.Equal(sdkManifest.ReadError, false);

                string manifestExtensionSDK = @"
                <FileList
                    DisplayName = ""My SDK""
                    ProductFamilyName = ""UnitTest SDKs""
                    FrameworkIdentity-Debug = ""Name=MySDK.10.Debug, MinVersion=1.0.0.0""
                    FrameworkIdentity-Retail = ""Name=MySDK.10, MinVersion=1.0.0.0""
                    TargetFramework = "".NETCore, version=v4.5; .NETFramework, version=v4.5""
                    MinVSVersion = ""11.0""
                    AppliesTo = ""WindowsAppContainer + WindowsXAML""
                    SupportPrefer32Bit = ""True""
                    SupportedArchitectures = ""x86;x64;ARM""
                    SupportsMultipleVersions = ""Error""
                    AppX-Debug-x86 = "".\AppX\Debug\x86\Microsoft.MySDK.x86.Debug.1.0.appx""
                    AppX-Debug-x64 = "".\AppX\Debug\x64\Microsoft.MySDK.x64.Debug.1.0.appx""
                    AppX-Debug-ARM = "".\AppX\Debug\ARM\Microsoft.MySDK.ARM.Debug.1.0.appx""
                    AppX-Retail-x86 = "".\AppX\Retail\x86\Microsoft.MySDK.x86.1.0.appx""
                    AppX-Retail-x64 = "".\AppX\Retail\x64\Microsoft.MySDK.x64.1.0.appx""
                    AppX-Retail-ARM = "".\AppX\Retail\ARM\Microsoft.MySDK.ARM.1.0.appx"" 
                    CopyRedistToSubDirectory = "".""
                    DependsOn = ""SDKB, version=2.0""
                    MoreInfo = ""http://msdn.microsoft.com/MySDK""
                    MaxPlatformVersion = ""8.0""
                    MinOSVersion = ""6.2.1""
                    MaxOSVersionTested = ""6.2.3"">

                    <File Reference = ""MySDK.Sprint.winmd"" Implementation = ""XNASprintImpl.dll"">
                        <Registration Type = ""Flipper"" Implementation = ""XNASprintFlipperImpl.dll"" />
                        <Registration Type = ""Flexer"" Implementation = ""XNASprintFlexerImpl.dll"" />
                        <ToolboxItems VSCategory = ""Toolbox.Default"" />
                    </File>
                </FileList>";


                File.WriteAllText(manifestFile, manifestExtensionSDK);
                sdkManifest = new SDKManifest(manifestPath);

                Assert.True(sdkManifest.AppxLocations.ContainsKey("AppX-Debug-x86"));
                Assert.True(sdkManifest.AppxLocations.ContainsKey("AppX-Debug-x64"));
                Assert.True(sdkManifest.AppxLocations.ContainsKey("AppX-Debug-ARM"));

                Assert.True(sdkManifest.AppxLocations.ContainsKey("AppX-Retail-x86"));
                Assert.True(sdkManifest.AppxLocations.ContainsKey("AppX-Retail-x64"));
                Assert.True(sdkManifest.AppxLocations.ContainsKey("AppX-Retail-ARM"));

                Assert.Equal(sdkManifest.AppxLocations["AppX-Debug-x86"], ".\\AppX\\Debug\\x86\\Microsoft.MySDK.x86.Debug.1.0.appx");
                Assert.Equal(sdkManifest.AppxLocations["AppX-Debug-x64"], ".\\AppX\\Debug\\x64\\Microsoft.MySDK.x64.Debug.1.0.appx");
                Assert.Equal(sdkManifest.AppxLocations["AppX-Debug-ARM"], ".\\AppX\\Debug\\ARM\\Microsoft.MySDK.ARM.Debug.1.0.appx");

                Assert.Equal(sdkManifest.AppxLocations["AppX-Retail-x86"], ".\\AppX\\Retail\\x86\\Microsoft.MySDK.x86.1.0.appx");
                Assert.Equal(sdkManifest.AppxLocations["AppX-Retail-x64"], ".\\AppX\\Retail\\x64\\Microsoft.MySDK.x64.1.0.appx");
                Assert.Equal(sdkManifest.AppxLocations["AppX-Retail-ARM"], ".\\AppX\\Retail\\ARM\\Microsoft.MySDK.ARM.1.0.appx");

                Assert.Equal(sdkManifest.CopyRedistToSubDirectory, ".");
                Assert.Equal(sdkManifest.DependsOnSDK, "SDKB, version=2.0");
                Assert.Equal(sdkManifest.DisplayName, "My SDK");

                Assert.True(sdkManifest.FrameworkIdentities.ContainsKey("FrameworkIdentity-Debug"));
                Assert.True(sdkManifest.FrameworkIdentities.ContainsKey("FrameworkIdentity-Retail"));

                Assert.Equal(sdkManifest.FrameworkIdentities["FrameworkIdentity-Debug"], "Name=MySDK.10.Debug, MinVersion=1.0.0.0");
                Assert.Equal(sdkManifest.FrameworkIdentities["FrameworkIdentity-Retail"], "Name=MySDK.10, MinVersion=1.0.0.0");

                Assert.Equal(sdkManifest.FrameworkIdentity, null);
                Assert.Equal(sdkManifest.MaxPlatformVersion, "8.0");
                Assert.Equal(sdkManifest.MinVSVersion, "11.0");
                Assert.Equal(sdkManifest.MinOSVersion, "6.2.1");
                Assert.Equal(sdkManifest.MaxOSVersionTested, "6.2.3");
                Assert.Equal(sdkManifest.PlatformIdentity, null);
                Assert.Equal(sdkManifest.ProductFamilyName, "UnitTest SDKs");
                Assert.Equal(sdkManifest.SDKType, SDKType.Unspecified);
                Assert.Equal(sdkManifest.SupportedArchitectures, "x86;x64;ARM");
                Assert.Equal(sdkManifest.SupportPrefer32Bit, "True");
                Assert.Equal(sdkManifest.SupportsMultipleVersions, MultipleVersionSupport.Error);
                Assert.Equal(sdkManifest.MoreInfo, "http://msdn.microsoft.com/MySDK");
                Assert.Equal(sdkManifest.ReadError, false);

                File.WriteAllText(manifestFile, "Hello");
                sdkManifest = new SDKManifest(manifestPath);

                Assert.Equal(sdkManifest.ReadError, true);
            }
            finally
            {
                Directory.Delete(manifestPath, true /* for recursive deletion */);
            }
        }
        public void VerifySDKManifestWithNullOrEmptyParameter()
        {
            bool exceptionCaught = false;
            try
            {
                SDKManifest manifestObject = new SDKManifest(null);
                Assert.Fail();
            }
            catch (ArgumentNullException)
            {
                exceptionCaught = true;
            }

            Assert.IsTrue(exceptionCaught);

            exceptionCaught = false;
            try
            {
                SDKManifest manifestObject = new SDKManifest("");
                Assert.Fail();
            }
            catch (ArgumentException)
            {
                exceptionCaught = true;
            }

            Assert.IsTrue(exceptionCaught);
        }