Inheritance: ITestFile
コード例 #1
0
        public StatLightConfiguration GetStatLightConfigurationForDll(UnitTestProviderType unitTestProviderType, string dllPath, 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 entryPointAssembly = string.Empty;
            string runtimeVersion = null;
            if (isRemoteRun)
            {
            }
            else
            {
                AssertFileExists(dllPath);

                var dllFileInfo = new FileInfo(dllPath);
                var assemblyResolver = new AssemblyResolver(_logger);
                var dependentAssemblies = assemblyResolver.ResolveAllDependentAssemblies(dllFileInfo.FullName);

                var coreFileUnderTest = new TestFile(dllFileInfo.FullName);
                var dependentFilesUnderTest = dependentAssemblies.Select(file => new TestFile(file)).ToList();
                dependentFilesUnderTest.Add(coreFileUnderTest);
                var xapReadItems = new TestFileCollection(_logger,
                                                          AssemblyName.GetAssemblyName(dllFileInfo.FullName).ToString(),
                                                          dependentFilesUnderTest);

                SetupUnitTestProviderType(xapReadItems, ref unitTestProviderType, ref microsoftTestingFrameworkVersion);

                entryPointAssembly = xapReadItems.TestAssemblyFullName;

                filesToCopyIntoHostXap =()=>
                                            {
                                                return new TestFileCollection(_logger,
                                                                       AssemblyName.GetAssemblyName(dllFileInfo.FullName)
                                                                           .ToString(),
                                                                       dependentFilesUnderTest).FilesContainedWithinXap;
                                            };
            }

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

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

            return new StatLightConfiguration(clientConfig, serverConfig);
        }
コード例 #2
0
        private StatLightConfiguration GetStatLightConfigurationForDll(string dllPath)
        {
            Func<IEnumerable<ITestFile>> filesToCopyIntoHostXap = () => new List<ITestFile>();
            string entryPointAssembly = string.Empty;
            string runtimeVersion = null;

            var dllFileInfo = new FileInfo(dllPath);
            var assemblyResolver = new AssemblyResolver(_logger);
            var dependentAssemblies = assemblyResolver.ResolveAllDependentAssemblies(dllFileInfo.FullName);

            var coreFileUnderTest = new TestFile(dllFileInfo.FullName);
            var dependentFilesUnderTest = dependentAssemblies.Select(file => new TestFile(file)).ToList();
            dependentFilesUnderTest.Add(coreFileUnderTest);
            var xapReadItems = new TestFileCollection(_logger,
                                                        AssemblyName.GetAssemblyName(dllFileInfo.FullName).ToString(),
                                                        dependentFilesUnderTest);

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

            SetupUnitTestProviderType(xapReadItems, ref unitTestProviderType, ref microsoftTestingFrameworkVersion);

            entryPointAssembly = xapReadItems.TestAssemblyFullName;

            filesToCopyIntoHostXap = () =>
                                        {
                                            return new TestFileCollection(_logger,
                                                                    AssemblyName.GetAssemblyName(dllFileInfo.FullName)
                                                                        .ToString(),
                                                                    dependentFilesUnderTest).FilesContainedWithinXap;
                                        };

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

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

            return new StatLightConfiguration(clientConfig, serverConfig);
        }
コード例 #3
0
        private Func<IEnumerable<ITestFile>> RewriteFunc(Func<IEnumerable<ITestFile>> filesToCopyIntoHostXapFunc)
        {
            string fileString = @"
            <Settings>
            <Port>{0}</Port>
            </Settings>
            ".FormatWith(_webServerLocation.Port);
            var settingsTestFile = new TestFile("StatLight.Settings.xml", fileString.ToByteArray());

            Func<IEnumerable<ITestFile>> x = () => filesToCopyIntoHostXapFunc().Concat(new[] {settingsTestFile});
            return x;
        }