示例#1
0
            protected override void Before_all_tests()
            {
                base.Before_all_tests();

                _xapPath = Path.GetTempFileName() + ".zip";

                _filesToCleanup.Add(_xapPath);

                Action<XapZipArchive> addTempFileToZip = (zipFile) =>
                {
                    var pathToTempFileToPlaceInXap = Path.GetTempFileName();
                    using (var writer = File.CreateText(pathToTempFileToPlaceInXap))
                    {
                        writer.Close();
                    }
                    zipFile.AddFile(pathToTempFileToPlaceInXap);
                    _filesToCleanup.Add(pathToTempFileToPlaceInXap);
                };

                using (var zipFile = new XapZipArchive())
                {
                    addTempFileToZip(zipFile);
                    addTempFileToZip(zipFile);
                    addTempFileToZip(zipFile);
                    addTempFileToZip(zipFile);
                    zipFile.Save(_xapPath);
                }

                _testFileCollection = new Core.WebServer.XapInspection.XapReader(new ConsoleLogger(LogChatterLevels.Full)).LoadXapUnderTest(_xapPath);
            }
示例#2
0
            protected override void Before_all_tests()
            {
                base.Before_all_tests();

                _xapPath = Path.GetTempFileName() + ".zip";

                _filesToCleanup.Add(_xapPath);

                Action <XapZipArchive> addTempFileToZip = (zipFile) =>
                {
                    var pathToTempFileToPlaceInXap = Path.GetTempFileName();
                    using (var writer = File.CreateText(pathToTempFileToPlaceInXap))
                    {
                        writer.Close();
                    }
                    zipFile.AddFile(pathToTempFileToPlaceInXap);
                    _filesToCleanup.Add(pathToTempFileToPlaceInXap);
                };

                using (var zipFile = new XapZipArchive())
                {
                    addTempFileToZip(zipFile);
                    addTempFileToZip(zipFile);
                    addTempFileToZip(zipFile);
                    addTempFileToZip(zipFile);
                    zipFile.Save(_xapPath);
                }

                _testFileCollection = new Core.WebServer.XapInspection.XapReader(new ConsoleLogger(LogChatterLevels.Full)).LoadXapUnderTest(_xapPath);
            }
示例#3
0
        public static void AddTempFile(this XapZipArchive xapZipArchive, string fileName, byte[] value = null)
        {
            if (value == null)
            {
                value = new byte[] { 1, 2 }
            }
            ;

            XapRewriter.AddFileInternal(xapZipArchive, fileName, value);
        }
    }
示例#4
0
        protected override void Before_all_tests()
        {
            base.Before_all_tests();

            _xapRewriter = new XapRewriter(base.TestLogger);


            var appManifest = @"<Deployment xmlns=""http://schemas.microsoft.com/client/2007/deployment"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" EntryPointAssembly=""StatLight.Client.Harness"" EntryPointType=""StatLight.Client.Harness.App"" RuntimeVersion=""4.0.50826.0"">
  <Deployment.Parts>
    <AssemblyPart x:Name=""StatLight.Client.Harness"" Source=""StatLight.Client.Harness.dll"" />
    <AssemblyPart x:Name=""System.Windows.Controls"" Source=""System.Windows.Controls.dll"" />
    <AssemblyPart x:Name=""System.Xml.Linq"" Source=""System.Xml.Linq.dll"" />
    <AssemblyPart x:Name=""System.Xml.Serialization"" Source=""System.Xml.Serialization.dll"" />
    <AssemblyPart x:Name=""Microsoft.Silverlight.Testing"" Source=""Microsoft.Silverlight.Testing.dll"" />
    <AssemblyPart x:Name=""Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight"" Source=""Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll"" />
  </Deployment.Parts>
</Deployment>
";

            var originalXapHost = new XapZipArchive();

            originalXapHost.AddTempFile("AppManifest.xaml", appManifest.ToByteArray());
            originalXapHost.AddTempFile("StatLight.Client.Harness.dll");
            originalXapHost.AddTempFile("StatLight.Client.Harness.MSTest.dll");
            originalXapHost.AddTempFile("System.Windows.Controls.dll");
            originalXapHost.AddTempFile("System.Xml.Linq.dll");
            originalXapHost.AddTempFile("System.Xml.Serialization.dll");
            originalXapHost.AddTempFile("Microsoft.Silverlight.Testing.dll");
            originalXapHost.AddTempFile("Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll");
            _originalXapHost = originalXapHost.ToByteArray();

            var appManifest2 = @"<Deployment xmlns=""http://schemas.microsoft.com/client/2007/deployment"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" EntryPointAssembly=""StatLight.IntegrationTests.Silverlight.MSTest"" EntryPointType=""StatLight.IntegrationTests.Silverlight.App"" RuntimeVersion=""4.0.50826.0"">
  <Deployment.Parts>
    <AssemblyPart x:Name=""StatLight.IntegrationTests.Silverlight.MSTest"" Source=""StatLight.IntegrationTests.Silverlight.MSTest.dll"" />
    <AssemblyPart x:Name=""Microsoft.Silverlight.Testing"" Source=""Microsoft.Silverlight.Testing.dll"" />
    <AssemblyPart x:Name=""Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight"" Source=""Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll"" />
  </Deployment.Parts>
</Deployment>
";

            var originalXapUnderTest = new XapZipArchive();

            originalXapUnderTest.AddTempFile("/AppManifest.xaml", appManifest2.ToByteArray());
            originalXapUnderTest.AddTempFile("/StatLight.IntegrationTests.Silverlight.MSTest.dll");
            originalXapUnderTest.AddTempFile("/Microsoft.Silverlight.Testing.dll");
            originalXapUnderTest.AddTempFile("/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll");
            originalXapUnderTest.AddTempFile("/Test/Test/Test.xml", "Hello".ToByteArray());

            // This was a crazy case that the Sterling db project exposed to StatLight (They had duplicate test assemblies)
            originalXapUnderTest.AddTempFile("/Binaries/Microsoft.Silverlight.Testing.dll", new byte[] { 1, 2 });
            originalXapUnderTest.AddTempFile("/Binaries/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll", new byte[] { 1, 2 });

            _originalXapUnderTest = originalXapUnderTest.ToByteArray();

            _expectedAppManifest = @"<Deployment xmlns=""http://schemas.microsoft.com/client/2007/deployment"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" EntryPointAssembly=""StatLight.Client.Harness"" EntryPointType=""StatLight.Client.Harness.App"" RuntimeVersion=""4.0.50826.0"">
  <Deployment.Parts>
    <AssemblyPart x:Name=""StatLight.Client.Harness"" Source=""StatLight.Client.Harness.dll"" />
    <AssemblyPart x:Name=""System.Windows.Controls"" Source=""System.Windows.Controls.dll"" />
    <AssemblyPart x:Name=""System.Xml.Linq"" Source=""System.Xml.Linq.dll"" />
    <AssemblyPart x:Name=""System.Xml.Serialization"" Source=""System.Xml.Serialization.dll"" />
    <AssemblyPart x:Name=""Microsoft.Silverlight.Testing"" Source=""Microsoft.Silverlight.Testing.dll"" />
    <AssemblyPart x:Name=""Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight"" Source=""Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll"" />
    <AssemblyPart x:Name=""StatLight.IntegrationTests.Silverlight.MSTest"" Source=""StatLight.IntegrationTests.Silverlight.MSTest.dll"" />
  </Deployment.Parts>
</Deployment>
";
            var expectedXapHost = new XapZipArchive();

            expectedXapHost.AddTempFile("/StatLight.Client.Harness.dll");
            expectedXapHost.AddTempFile("/StatLight.Client.Harness.MSTest.dll");
            expectedXapHost.AddTempFile("/System.Windows.Controls.dll");
            expectedXapHost.AddTempFile("/System.Xml.Linq.dll");
            expectedXapHost.AddTempFile("/System.Xml.Serialization.dll");
            expectedXapHost.AddTempFile("/Microsoft.Silverlight.Testing.dll");
            expectedXapHost.AddTempFile("/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll");
            expectedXapHost.AddTempFile("/StatLight.IntegrationTests.Silverlight.MSTest.dll");
            expectedXapHost.AddTempFile("/Test/Test/Test.xml", "Hello".ToByteArray());
            expectedXapHost.AddTempFile("/AppManifest.xaml", _expectedAppManifest.ToByteArray());

            // This was a crazy case that the Sterling db project exposed to StatLight (They had duplicate test assemblies)
            expectedXapHost.AddTempFile("/Binaries/Microsoft.Silverlight.Testing.dll");
            expectedXapHost.AddTempFile("/Binaries/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll");

            _expectedXapHost = expectedXapHost.ToByteArray();
        }
示例#5
0
        protected override void Before_all_tests()
        {
            base.Before_all_tests();

            _xapRewriter = new XapRewriter(base.TestLogger);

            var appManifest = @"<Deployment xmlns=""http://schemas.microsoft.com/client/2007/deployment"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" EntryPointAssembly=""StatLight.Client.Harness"" EntryPointType=""StatLight.Client.Harness.App"" RuntimeVersion=""4.0.50826.0"">
              <Deployment.Parts>
            <AssemblyPart x:Name=""StatLight.Client.Harness"" Source=""StatLight.Client.Harness.dll"" />
            <AssemblyPart x:Name=""System.Windows.Controls"" Source=""System.Windows.Controls.dll"" />
            <AssemblyPart x:Name=""System.Xml.Linq"" Source=""System.Xml.Linq.dll"" />
            <AssemblyPart x:Name=""System.Xml.Serialization"" Source=""System.Xml.Serialization.dll"" />
            <AssemblyPart x:Name=""Microsoft.Silverlight.Testing"" Source=""Microsoft.Silverlight.Testing.dll"" />
            <AssemblyPart x:Name=""Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight"" Source=""Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll"" />
              </Deployment.Parts>
            </Deployment>
            ";

            var originalXapHost = new XapZipArchive();
            originalXapHost.AddTempFile("AppManifest.xaml", appManifest.ToByteArray());
            originalXapHost.AddTempFile("StatLight.Client.Harness.dll");
            originalXapHost.AddTempFile("StatLight.Client.Harness.MSTest.dll");
            originalXapHost.AddTempFile("System.Windows.Controls.dll");
            originalXapHost.AddTempFile("System.Xml.Linq.dll");
            originalXapHost.AddTempFile("System.Xml.Serialization.dll");
            originalXapHost.AddTempFile("Microsoft.Silverlight.Testing.dll");
            originalXapHost.AddTempFile("Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll");
            _originalXapHost = originalXapHost.ToByteArray();

            var appManifest2 = @"<Deployment xmlns=""http://schemas.microsoft.com/client/2007/deployment"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" EntryPointAssembly=""StatLight.IntegrationTests.Silverlight.MSTest"" EntryPointType=""StatLight.IntegrationTests.Silverlight.App"" RuntimeVersion=""4.0.50826.0"">
              <Deployment.Parts>
            <AssemblyPart x:Name=""StatLight.IntegrationTests.Silverlight.MSTest"" Source=""StatLight.IntegrationTests.Silverlight.MSTest.dll"" />
            <AssemblyPart x:Name=""Microsoft.Silverlight.Testing"" Source=""Microsoft.Silverlight.Testing.dll"" />
            <AssemblyPart x:Name=""Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight"" Source=""Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll"" />
              </Deployment.Parts>
            </Deployment>
            ";

            var originalXapUnderTest = new XapZipArchive();
            originalXapUnderTest.AddTempFile("/AppManifest.xaml", appManifest2.ToByteArray());
            originalXapUnderTest.AddTempFile("/StatLight.IntegrationTests.Silverlight.MSTest.dll");
            originalXapUnderTest.AddTempFile("/Microsoft.Silverlight.Testing.dll");
            originalXapUnderTest.AddTempFile("/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll");
            originalXapUnderTest.AddTempFile("/Test/Test/Test.xml", "Hello".ToByteArray());

            // This was a crazy case that the Sterling db project exposed to StatLight (They had duplicate test assemblies)
            originalXapUnderTest.AddTempFile("/Binaries/Microsoft.Silverlight.Testing.dll", new byte[] { 1, 2 });
            originalXapUnderTest.AddTempFile("/Binaries/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll", new byte[] { 1, 2 });

            _originalXapUnderTest = originalXapUnderTest.ToByteArray();

            _expectedAppManifest = @"<Deployment xmlns=""http://schemas.microsoft.com/client/2007/deployment"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" EntryPointAssembly=""StatLight.Client.Harness"" EntryPointType=""StatLight.Client.Harness.App"" RuntimeVersion=""4.0.50826.0"">
              <Deployment.Parts>
            <AssemblyPart x:Name=""StatLight.Client.Harness"" Source=""StatLight.Client.Harness.dll"" />
            <AssemblyPart x:Name=""System.Windows.Controls"" Source=""System.Windows.Controls.dll"" />
            <AssemblyPart x:Name=""System.Xml.Linq"" Source=""System.Xml.Linq.dll"" />
            <AssemblyPart x:Name=""System.Xml.Serialization"" Source=""System.Xml.Serialization.dll"" />
            <AssemblyPart x:Name=""Microsoft.Silverlight.Testing"" Source=""Microsoft.Silverlight.Testing.dll"" />
            <AssemblyPart x:Name=""Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight"" Source=""Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll"" />
            <AssemblyPart x:Name=""StatLight.IntegrationTests.Silverlight.MSTest"" Source=""StatLight.IntegrationTests.Silverlight.MSTest.dll"" />
              </Deployment.Parts>
            </Deployment>
            ";
            var expectedXapHost = new XapZipArchive();
            expectedXapHost.AddTempFile("/StatLight.Client.Harness.dll");
            expectedXapHost.AddTempFile("/StatLight.Client.Harness.MSTest.dll");
            expectedXapHost.AddTempFile("/System.Windows.Controls.dll");
            expectedXapHost.AddTempFile("/System.Xml.Linq.dll");
            expectedXapHost.AddTempFile("/System.Xml.Serialization.dll");
            expectedXapHost.AddTempFile("/Microsoft.Silverlight.Testing.dll");
            expectedXapHost.AddTempFile("/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll");
            expectedXapHost.AddTempFile("/StatLight.IntegrationTests.Silverlight.MSTest.dll");
            expectedXapHost.AddTempFile("/Test/Test/Test.xml", "Hello".ToByteArray());
            expectedXapHost.AddTempFile("/AppManifest.xaml", _expectedAppManifest.ToByteArray());

            // This was a crazy case that the Sterling db project exposed to StatLight (They had duplicate test assemblies)
            expectedXapHost.AddTempFile("/Binaries/Microsoft.Silverlight.Testing.dll");
            expectedXapHost.AddTempFile("/Binaries/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll");

            _expectedXapHost = expectedXapHost.ToByteArray();
        }