StatLight.Core.Configuration.StatLightConfigurationFactory.GetStatLightConfigurationForXap C# (CSharp) Method

GetStatLightConfigurationForXap() private method

private GetStatLightConfigurationForXap ( string xapPath ) : StatLightConfiguration
xapPath string
return StatLightConfiguration
        private StatLightConfiguration GetStatLightConfigurationForXap(string xapPath)
        {
            Func<IEnumerable<ITestFile>> filesToCopyIntoHostXap = () => new List<ITestFile>();
            string runtimeVersion = null;
            IEnumerable<string> testAssemblyFormalNames = new List<string>();
            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;
            testAssemblyFormalNames = testFileCollection.GetAssemblyNames();

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

            var clientConfig = new ClientTestRunConfiguration(
                unitTestProviderType: unitTestProviderType,
                methodsToTest:_options.MethodsToTest,
                tagFilters: _options.TagFilters,
                numberOfBrowserHosts: _options.NumberOfBrowserHosts,
                webBrowserType: _options.WebBrowserType,
                entryPointAssembly: entryPointAssembly,
                windowGeometry: _options.WindowGeometry,
                testAssemblyFormalNames: testAssemblyFormalNames);

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

            return new StatLightConfiguration(clientConfig, serverConfig);
        }

Usage Example

 private static StatLightConfiguration CreateStatLightConfigurationForXap(StatLightConfigurationFactory configurationFactory, IEnumerable<MethodTask> testMethods, string xapPath)
 {
     return configurationFactory.GetStatLightConfigurationForXap(
         unitTestProviderType: UnitTestProviderType.Undefined, // Let StatLight figure it out
         xapPath: xapPath,
         microsoftTestingFrameworkVersion: null, // Let StatLight figure it out
         methodsToTest: new Collection<string>(testMethods.Select(m => m.GetFullMethodName()).ToList()),
         tagFilters: null,
         numberOfBrowserHosts: 1, // Maybe you spin up 3 or 4 here if you know you're running a ton of tests
         isRemoteRun: false,
         queryString: "", // This is passed to the browser host page (say your test need some configuration - could be passed here - probably not a use case in ReSharper runner)
         webBrowserType: WebBrowserType.SelfHosted,
         forceBrowserStart: false,
         showTestingBrowserHost: false // If you need UI support this needs to be true
     );
 }
All Usage Examples Of StatLight.Core.Configuration.StatLightConfigurationFactory::GetStatLightConfigurationForXap