Ejemplo n.º 1
0
 private void ShouldLoadCorrectType(string fileName, UnitTestProviderType unitTestProviderType)
 {
     var xapReadItems = new XapReader(new ConsoleLogger(LogChatterLevels.Full)).LoadXapUnderTest(fileName);
     xapReadItems.UnitTestProvider.ShouldEqual(unitTestProviderType);
 }
        public StatLightConfiguration GetStatLightConfigurationForXap(UnitTestProviderType unitTestProviderType, string xapPath, MicrosoftTestingFrameworkVersion? microsoftTestingFrameworkVersion, Collection<string> methodsToTest, string tagFilters, int numberOfBrowserHosts, bool isRemoteRun, string queryString, WebBrowserType webBrowserType, bool forceBrowserStart, bool showTestingBrowserHost)
        {
            if (queryString == null)
                throw new ArgumentNullException("queryString");

            Func<IEnumerable<ITestFile>> filesToCopyIntoHostXap = () => new List<ITestFile>();
            string runtimeVersion = null;
            string entryPointAssembly = string.Empty;
            if (isRemoteRun)
            {
            }
            else
            {
                AssertFileExists(xapPath);

                var xapReader = new XapReader(_logger);

                TestFileCollection testFileCollection = xapReader.LoadXapUnderTest(xapPath);
                runtimeVersion = XapReader.GetRuntimeVersion(xapPath);

                SetupUnitTestProviderType(testFileCollection, ref unitTestProviderType, ref microsoftTestingFrameworkVersion);

                entryPointAssembly = testFileCollection.TestAssemblyFullName;

                filesToCopyIntoHostXap = () =>
                {
                    return xapReader.LoadXapUnderTest(xapPath).FilesContainedWithinXap;
                };

            }

            var clientConfig = new ClientTestRunConfiguration(unitTestProviderType, methodsToTest, tagFilters, numberOfBrowserHosts, webBrowserType, showTestingBrowserHost, entryPointAssembly);

            var serverConfig = CreateServerConfiguration(
                xapPath,
                clientConfig.UnitTestProviderType,
                microsoftTestingFrameworkVersion,
                filesToCopyIntoHostXap,
                DefaultDialogSmackDownElapseMilliseconds,
                queryString,
                forceBrowserStart,
                showTestingBrowserHost,
                runtimeVersion);

            return new StatLightConfiguration(clientConfig, serverConfig);
        }
        private StatLightConfiguration GetStatLightConfigurationForXap(string xapPath)
        {
            Func<IEnumerable<ITestFile>> filesToCopyIntoHostXap = () => new List<ITestFile>();
            string runtimeVersion = null;
            string entryPointAssembly = string.Empty;

            var xapReader = new XapReader(_logger);

            TestFileCollection testFileCollection = xapReader.LoadXapUnderTest(xapPath);
            runtimeVersion = XapReader.GetRuntimeVersion(xapPath);

            UnitTestProviderType unitTestProviderType = _options.UnitTestProviderType;
            MicrosoftTestingFrameworkVersion? microsoftTestingFrameworkVersion = _options.MicrosoftTestingFrameworkVersion;

            SetupUnitTestProviderType(testFileCollection, ref unitTestProviderType, ref microsoftTestingFrameworkVersion);

            entryPointAssembly = testFileCollection.TestAssemblyFullName;

            filesToCopyIntoHostXap = () =>
            {
                return xapReader.LoadXapUnderTest(xapPath).FilesContainedWithinXap;
            };

            var clientConfig = new ClientTestRunConfiguration(unitTestProviderType, _options.MethodsToTest, _options.TagFilters, _options.NumberOfBrowserHosts, _options.WebBrowserType, entryPointAssembly, _options.WindowGeometry);

            var serverConfig = CreateServerConfiguration(
                xapPath,
                clientConfig.UnitTestProviderType,
                microsoftTestingFrameworkVersion,
                filesToCopyIntoHostXap,
                _options.QueryString,
                _options.ForceBrowserStart,
                _options.WindowGeometry,
                runtimeVersion);

            return new StatLightConfiguration(clientConfig, serverConfig);
        }