Exemplo n.º 1
0
        public void Initialize(TRunner tunitRunner, List <string> testcaseIDList, List <ItemData> listItem)
        {
            _toastMessage = new ToastMessage();
            RunType.Value = RunType.MANUAL;
            _tunitRunner  = tunitRunner;
            _tunitRunner.SingleTestDone += OnSingleTestDone;
            _tcInfoList         = new List <TestcaseInfo>();
            _tcIDList           = testcaseIDList;
            _tsettings          = TSettings.GetInstance();
            _tsettings.IsManual = true;
            _listItem           = listItem;
            MakeTCInfoList();

            _summaryLabel1 = new Label()
            {
                Text              = "",
                HeightRequest     = 25,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                TextColor         = Color.White,
                FontSize          = 5,
            };
            _summaryLabel2 = new Label()
            {
                Text              = "",
                HeightRequest     = 25,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                TextColor         = Color.White,
                FontSize          = 5,
            };
            SetResultNumber(0, 0, 0);
            MakeTestPage();
        }
Exemplo n.º 2
0
        public TRunner(Assembly testAssembly)
        {
            _testAssembly = testAssembly;
#if TIZEN
            TSettings.GetInstance().ConnectTestkitStub();
#endif
        }
Exemplo n.º 3
0
    public TSettings LoadOrCreate <TSettings>() where TSettings : class, new()
    {
        var settingsFilePath = GetSettingsFilePath(typeof(TSettings));

        if (!File.Exists(settingsFilePath))
        {
            var settings = new TSettings();
            this.Save(settings);
            return(settings);
        }

        var settingsFileInfo = new FileInfo(settingsFilePath);

        if (settingsFileInfo.Length > 1 * 1024 * 1024)
        {
            throw new InvalidOperationException("Refusing to load settings files larger than 1 MB in size.");
        }

        try
        {
            var fileBytes = File.ReadAllBytes(settingsFilePath);
            return(JsonSerializer.Deserialize <TSettings>(fileBytes) ?? new TSettings());
        }
        catch
        {
            var settings = new TSettings();
            this.Save(settings);
            return(settings);
        }
    }
Exemplo n.º 4
0
        /// <summary>
        /// Execute the test suite automatically on the Tizen devidce
        /// </summary>
        public void LoadTestsuite(string dllPath, string pkgName)
        {
            TSettings.CurTCIndex = 0;
            if (pkgName == "")
            {
                TLogger.Write("The package name is invalid!");
                return;
            }
            TLogger.Write("Executing the application: " + pkgName + "...");


            string exeFilePathName = string.Format(dllPath + "Tizen.{0}.Tests.exe", pkgName);

            AssemblyName asmName = new AssemblyName(GetAssemblyName(exeFilePathName));
            _testAssembly = Assembly.Load(asmName);

            string pkgShareDir = string.Format("/home/owner/share/{0}", pkgName);
            System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(pkgShareDir);
            if (di.Exists == false)
            {
                di.Create();
            }

            string outputFilePathName = string.Format("{0}/{1}.xml", pkgShareDir, TESTCASE_XML_NAME);
            TSettings.GetInstance().SetOutputFilePathName(outputFilePathName);
            string[] s = new string[1] { exeFilePathName };
            //new TextRunner(_testAssembly).Execute(s);
            LoadTestsuite(s, outputFilePathName);
        }
Exemplo n.º 5
0
        public void ReportResults(ITestResult result)
        {
            Summary = new ResultSummary(result);

            if (Summary.ExplicitCount + Summary.SkipCount + Summary.IgnoreCount > 0)
            {
                _textUI.DisplayNotRunReport(result);
            }

            if (result.ResultState.Status == TestStatus.Failed)
            {
                _textUI.DisplayErrorsAndFailuresReport(result);
            }

                #if FULL
            if (_options.Full)
            {
                _textUI.PrintFullReport(_result);
            }
                #endif
            if (TSettings.GetInstance().IsManual == false)
            {
                _textUI.DisplayRunSettings();

                _textUI.DisplaySummaryReport(Summary);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Load setting from default path.
        /// </summary>
        /// <typeparam name="TSettings">Type of settings class</typeparam>
        /// <returns>Parsed settings. If file is not exist - return default</returns>
        public static TSettings Load <TSettings>()
            where TSettings : SettingsJson, new()
        {
            var settings = new TSettings();

            return(Load <TSettings>(settings.FilePath));
        }
Exemplo n.º 7
0
        public bool SafeRegister <TSettings, TPanel>(params string[] groups)
            where TSettings : GenericSettings, new()
            where TPanel : Control, Editable <TSettings>, new()
        {
            string name = new TSettings().SettingsID;

            if (byName(name) != null)
            {
                return(false);
            }
            if (bySettingsType(typeof(TSettings)) != null)
            {
                return(false);
            }

            ProfileType p = new SpecificProfileType <TSettings, TPanel>(name);

            profileTypes.Add(p);

            foreach (string g in groups)
            {
                groupByName(g).Register(p, name, typeof(TSettings));
            }
            return(true);
        }
Exemplo n.º 8
0
        public static TSettings CreateDefaultInstance <TSettings>() where TSettings : class, new()
        {
            var settings             = new TSettings();
            var settingsEntryMembers =
                typeof(TSettings).GetMembersWithCustomAttributeNoInherit <SettingsEntryAttribute>();

            foreach (var settingsEntryMember in settingsEntryMembers)
            {
                var attribute     = settingsEntryMember.GetCustomAttributeNoInherit <SettingsEntryAttribute>();
                var settingsField = settingsEntryMember as FieldInfo;
                if (settingsField != null)
                {
                    var fieldType    = settingsField.FieldType;
                    var defaultValue = GetDefaultValue(attribute, fieldType);
                    settingsField.SetValue(settings, defaultValue);
                    continue;
                }
                var settingsProperty = settingsEntryMember as PropertyInfo;
                if (settingsProperty != null)
                {
                    var propertyType = settingsProperty.PropertyType;
                    var defaultValue = GetDefaultValue(attribute, propertyType);
                    settingsProperty.SetValue(settings, defaultValue, new object[0]);
                    continue;
                }
                Asserts.Fail("unhandled settings-member type: {0}", settingsEntryMember.GetType());
            }

            return(settings);
        }
Exemplo n.º 9
0
        private TSettings GetNewSettingsObject <TSettings>() where TSettings : SiteSettingsBase, new()
        {
            TSettings settings = new TSettings();

            _legacySettingsProvider.ApplyLegacySettings(settings, _site.Id);
            return(settings);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Execute the tests in the assembly, passing in
        /// a list of arguments.
        /// </summary>
        /// <param name="args">arguments for NUnitLite to use</param>
        public void Execute()
        {
#if TIZEN
            #region tronghieu.d - Create new thread to run test and mainthread waiting for invoke test method.
            TAsyncThreadMgr asyncThreadMgr = TAsyncThreadMgr.GetInstance();
            ManualResetEvent methodExecutionResetEvent = asyncThreadMgr.GetMethodExecutionResetEvent();
            methodExecutionResetEvent.Reset();

            Task t = Task.Run(() =>
                {
                    _textRunner.Execute(args);
                    asyncThreadMgr.SetData(null, null, null, null, false);
                    methodExecutionResetEvent.Set();
                });
            t.GetAwaiter().OnCompleted(() =>
                {
                    OnSingleTestDone(TSettings.GetInstance().GetSingleTestDoneEventArgs());
                });
            methodExecutionResetEvent.WaitOne();
            asyncThreadMgr.RunTestMethod();
            #endregion
#else
            new TextRunner(_testAssembly).Execute(args);
#endif
        }
Exemplo n.º 11
0
 internal P_State(TSettings settings, bool setOnceMark, bool getOnceMark, ExceptionDispatchInfo validationError)
 {
     Settings        = settings;
     SetOnceMark     = setOnceMark;
     GetOnceMark     = getOnceMark;
     ValidationError = validationError;
 }
Exemplo n.º 12
0
        public Experiment()
        {
            Settings = new TSettings();
            timer.Interval = 250;
            timer.Tick += OnDataReceived;

            ExperimentCaption = "Заглушка";
        }
Exemplo n.º 13
0
        public TRunner(Assembly testAssembly)
        {
            _testAssembly = testAssembly;
            Tizen.Log.Fatal("NUITEST", $"");
            Tizen.Log.Fatal("NUITEST", $"TRunner() _testAssembly={_testAssembly}");
#if TIZEN
            TSettings.GetInstance().ConnectTestkitStub();
#endif
        }
Exemplo n.º 14
0
 /// <summary>
 /// Construct a CompositeWorkItem for executing a test suite
 /// using a filter to select child tests.
 /// </summary>
 /// <param name="suite">The TestSuite to be executed</param>
 /// <param name="childFilter">A filter used to select child tests</param>
 public CompositeWorkItem(TestSuite suite, ITestFilter childFilter)
     : base(suite)
 {
     _suite       = suite;
     _suiteResult = Result as TestSuiteResult;
     _childFilter = childFilter;
     _countOrder  = 0;
     tsettings    = TSettings.GetInstance();
 }
Exemplo n.º 15
0
        /// <summary>
        /// Execute the test suite automatically on the Tizen devidce
        /// </summary>
        public void LoadTestsuite()
        {
            Tizen.Log.Fatal("NUITEST", $"");
            Tizen.Log.Fatal("NUITEST", $"LoadTestsuite()");
            TSettings.CurTCIndex = 0;
            string cache_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
            string dllPath    = cache_path.Replace("res", "bin");//Cache->res
            string pkgName    = GetPackageName(dllPath);

            if (pkgName == "")
            {
                Tizen.Log.Fatal("NUITEST", $"The package name is invalid!");
                TLogger.WriteError("The package name is invalid!");
                return;
            }

            //TLogger.Write("Executing the application: " + pkgName + "...");
            Tizen.Log.Fatal("NUITEST", $"Executing the application: {pkgName}");
            string exeFilePathName = "";

            if (dllPath.Contains("netcoreapp"))
            {
                exeFilePathName = string.Format(dllPath + "Tizen.{0}Tests.dll", pkgName);
            }
            else
            {
                exeFilePathName = string.Format(dllPath + "Debug/netcoreapp3.1/Tizen.{0}dll", pkgName);
            }
            //TLogger.Write("exeFilePathName : " + exeFilePathName);
            Tizen.Log.Fatal("NUITEST", $"exeFilePathName : {exeFilePathName}");

            AssemblyName asmName = new AssemblyName(GetAssemblyName(exeFilePathName));

            _testAssembly = Assembly.LoadFrom(exeFilePathName);

            string pkgShareDir = $"{dllPath}{pkgName}";

            System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(pkgShareDir);
            if (di.Exists == false)
            {
                di.Create();
            }

            string outputFilePathName = string.Format("{0}/{1}.xml", pkgShareDir, TESTCASE_XML_NAME);

            TSettings.GetInstance().SetOutputFilePathName(outputFilePathName);
            string[] s = new string[1] {
                exeFilePathName
            };

            Tizen.Log.Fatal("NUITEST", $"outputFilePathName : {outputFilePathName}");

            //new TextRunner(_testAssembly).Execute(s);
            LoadTestsuite(s, outputFilePathName);
        }
Exemplo n.º 16
0
        public TSettings CreateExportSettings <TSettings>()
            where TSettings : UTinyAssetExportSettings, new()
        {
            var settings = new TSettings()
            {
                VersionStorage = VersionStorage
            };

            s_ExportSettings.SetValue(this, settings);

            return(settings);
        }
Exemplo n.º 17
0
        //Constructor  FromString( s,  Settings)
        public TGameRR(string s, TSettings Settings)
        {
            string[] a;
            string[] b;
            int      i;
            int      j;

            this.Settings = Settings;
            // Create Match to point on later
            CurrentMatch = new TMatch();
            CurrentA     = 0;
            CurrentB     = 0;
            a            = UHelpers.UHelpers.Explode(s, Units.Class.SEP_GAME);
            // Players + nPlayers
            b        = UHelpers.UHelpers.Explode(a[1], Units.Class.SEP_LIST);
            nPlayers = b.Length;
            Players  = new TPlayer[nPlayers];
            for (i = 0; i < nPlayers; i++)
            {
                Players[i] = new TPlayer(b[i]);
            }
            // PointsGrid
            b          = UHelpers.UHelpers.Explode(a[2], Units.Class.SEP_LIST);
            PointsGrid = new int[nPlayers, nPlayers];
            for (i = 0; i < nPlayers; i++)
            {
                for (j = 0; j < nPlayers; j++)
                {
                    PointsGrid[i, j] = Convert.ToInt32(b[i * nPlayers + j]);
                }
            }
            // TimeGrid
            b        = UHelpers.UHelpers.Explode(a[3], Units.Class.SEP_LIST);
            TimeGrid = new int[nPlayers, nPlayers];
            for (i = 0; i < nPlayers; i++)
            {
                for (j = 0; j < nPlayers; j++)
                {
                    TimeGrid[i, j] = Convert.ToInt32(b[i * nPlayers + j]);
                }
            }
            // CountList
            b         = UHelpers.UHelpers.Explode(a[4], Units.Class.SEP_LIST);
            CountList = new int[nPlayers];
            for (i = 0; i < nPlayers; i++)
            {
                CountList[i] = Convert.ToInt32(b[i]);
            }
            // TimeStarted
            TimeStarted = Convert.ToDateTime(a[5]);
        }
Exemplo n.º 18
0
 public ServiceHostBase(
     TSettings settings,
     Func <TSettings, TService> serviceFactory,
     Type serviceType,
     params Uri[] baseAddresses
     )
     : base(serviceType, baseAddresses)
 {
     foreach (var contractDescription in this.ImplementedContracts.Values)
     {
         var provider = new ServiceInstanceProviderBase(settings, serviceFactory);
         contractDescription.Behaviors.Add(provider);
     }
 }
Exemplo n.º 19
0
        private GetSettingsObject <TSettings> GetSettingObject <TSettings>() where TSettings : SiteSettingsBase, new()
        {
            string    fileLocation = GetFileLocation(typeof(TSettings));
            TSettings result       = null;

            if (File.Exists(fileLocation))
            {
                string readAllText = File.ReadAllText(fileLocation);
                result = JsonConvert.DeserializeObject <TSettings>(readAllText);
            }
            return(result != null
                ? new GetSettingsObject <TSettings>(result)
                : new GetSettingsObject <TSettings>(GetNewSettingsObject <TSettings>(), true));
        }
Exemplo n.º 20
0
        /// <summary>
        /// 转换为子对象(拷贝对象实例)。
        /// </summary>
        /// <typeparam name="TSettings">配置类型。</typeparam>
        /// <returns>返回转换后的对象。</returns>
        public virtual TSettings As <TSettings>() where TSettings : SmsSettings, new()
        {
            var settings = new TSettings();

            foreach (var extendKey in ExtendKeys)
            {
                settings[extendKey] = this[extendKey];
            }

            settings.Client    = Client;
            settings.Id        = Id;
            settings.AppId     = AppId;
            settings.AppSecret = AppSecret;
            return(settings);
        }
Exemplo n.º 21
0
        public MainPage()
        {
            _tunitrunner = new TRunner();
            _tunitrunner.LoadTestsuite();
            _listNotPass = new List <string>();
            _tcIDList    = new List <string>();
            _listItem    = new List <ItemData>();
            _listNotPass = TSettings.GetInstance().GetNotPassListManual();

            int count = 0;

            if (_listNotPass.Count == 0)
            {
                foreach (KeyValuePair <string, ITest> pair in _tunitrunner.GetTestList())
                {
                    count++;
                    _listItem.Add(new ItemData {
                        No = count, TCName = pair.Key, Result = StrResult.NOTRUN
                    });
                    _tcIDList.Add(pair.Key);
                }
            }
            else
            {
                foreach (var tc in _listNotPass)
                {
                    count++;
                    _listItem.Add(new ItemData {
                        No = count, TCName = tc, Result = StrResult.NOTRUN
                    });
                    _tcIDList.Add(tc);
                }
            }

            ResultNumber.Total = ResultNumber.NotRun = _tcIDList.Count;

            if (_listItem.Count != 0)
            {
                _testPage = TestPage.GetInstance();
                _testPage.Initialize(_tunitrunner, _tcIDList, _listItem);
                _testPage.TestcaseDone += OnTestcaseDone;
            }
            MakeWindowPage();

            _navigationPage = new NavigationPage(_mainContentPage);
            NavigationPage.SetHasNavigationBar(_mainContentPage, false);
            MainPage = _navigationPage;
        }
Exemplo n.º 22
0
        public TSettings LoadData <TSettings>()
            where TSettings : ISettings, new()
        {
            var settings = new TSettings();
            var fullpath = MakeFilename(settings);

            lock (_latch)
            {
                if (File.Exists(fullpath))
                {
                    var json = File.ReadAllText(fullpath);
                    return(JsonConvert.DeserializeObject <TSettings>(json));
                }
            }
            return(settings);
        }
Exemplo n.º 23
0
 /// <summary>
 /// Method that performs actually performs the work.
 /// </summary>
 protected override void PerformWork()
 {
     try
     {
         Result = _command.Execute(Context);
         // [DuongNT]: Write out the method's results
         if (!TSettings.GetInstance().IsSlaveMode&& !TSettings.GetInstance().IsManual)
         {
             TLogger.Write("##### Result of [" + Result.FullName + "] TC : " + Result.ResultState.ToString());
         }
     }
     finally
     {
         WorkItemComplete();
     }
 }
Exemplo n.º 24
0
        public TSettings GetSettings <TSettings>() where TSettings : ISettings, new()
        {
            TSettings settings = Activator.CreateInstance <TSettings>();

            // get properties we can write to
            var properties = from prop in typeof(TSettings).GetProperties()
                             where prop.CanWrite && prop.CanRead
                             let setting = this.GetSettingByKey <string>(typeof(TSettings).Name + "." + prop.Name)
                                           where setting != null
                                           where ConvertHelper.GetCustomTypeConverter(prop.PropertyType).CanConvertFrom(typeof(string))
                                           let value = ConvertHelper.GetCustomTypeConverter(prop.PropertyType).ConvertFromInvariantString(setting)
                                                       select new { prop, value };

            // assign properties
            properties.ToList().ForEach(p => p.prop.SetValue(settings, p.value, null));

            return(settings);
        }
Exemplo n.º 25
0
 public TSettings GetSiteSettings <TSettings>() where TSettings : SiteSettingsBase, new()
 {
     lock (ReadLockObject)
     {
         if (!GetSiteCache().ContainsKey(typeof(TSettings)))
         {
             GetSettingsObject <TSettings> settingObject = GetSettingObject <TSettings>();
             TSettings settings = settingObject.Settings;
             if (settingObject.IsNew)
             {
                 SaveSettings(settings);
             }
             else
             {
                 GetSiteCache()[settings.GetType()] = settings;
             }
         }
         return(GetSiteCache()[typeof(TSettings)] as TSettings);
     }
 }
Exemplo n.º 26
0
        static IComponentRegistration BuildRegistration <TSettings>() where TSettings : ISettings, new()
        {
            return(RegistrationBuilder
                   .ForDelegate((c, p) =>
            {
                TSettings settings = default;

                int currentStoreId = c.ResolveOptional <IStoreContext>()?.CurrentStore?.Id ?? 0;
                var settingFactory = c.ResolveOptional <ISettingFactory>();
                if (settingFactory != null)
                {
                    settings = settingFactory.LoadSettings <TSettings>(currentStoreId);
                }

                return settings ?? new TSettings();
            })
                   //.InstancePerLifetimeScope()
                   .ExternallyOwned()
                   .CreateRegistration());
        }
Exemplo n.º 27
0
        //Constructor  Create( Candidates,  Settings)
        public TGameRR(TPlayer[] Candidates, TSettings Settings)
        {
            int i;
            int j;

            this.Settings = Settings;
            nPlayers      = Candidates.Length;
            TimeStarted   = DateTime.MinValue; //done in GetNextMatch
            // Copy Players to own List
            Players = new TPlayer[nPlayers];
            for (i = 0; i < nPlayers; i++)
            {
                Players[i]    = Candidates[i];
                Players[i].ID = i;
            }
            // Init Matrix and Counter Table
            PointsGrid = new int[nPlayers, nPlayers];
            TimeGrid   = new int[nPlayers, nPlayers];
            CountList  = new int[nPlayers];
            for (i = 0; i < nPlayers; i++)
            {
                for (j = 0; j < nPlayers; j++)
                {
                    if (i == j)
                    {
                        PointsGrid[i, j] = -1;
                        TimeGrid[i, j]   = -1;
                    }
                    else
                    {
                        PointsGrid[i, j] = 0;
                        TimeGrid[i, j]   = 0;
                    }
                }
                CountList[i] = 99;
            }
            // Create Match to point on later
            CurrentMatch = new TMatch();
            CurrentA     = 0;
            CurrentB     = 0;
        }
Exemplo n.º 28
0
        public async Task <TSettings> LoadAutoSaveAsync <TSettings>() where TSettings : class, ISettings, INotifyPropertyChanged, new()
        {
            return(await Task <TSettings> .Factory.StartNew(() =>
            {
                var exists = File.Exists(Path);

                if (exists)
                {
                    try
                    {
                        using (var sr = File.Open(Path, FileMode.Open))
                        {
                            var settings = (TSettings) new BinaryFormatter().Deserialize(sr);
                            settings.PropertyChanged += async(s, e) =>
                            {
                                await SaveAsync(settings);
                            };
                            return settings;
                        }
                    }
                    catch
                    {
                        var settings = new TSettings();
                        settings.PropertyChanged += async(s, e) =>
                        {
                            await SaveAsync(settings);
                        };
                        return settings;
                    }
                }
                else
                {
                    var settings = new TSettings();
                    settings.PropertyChanged += async(s, e) =>
                    {
                        await SaveAsync(settings);
                    };
                    return settings;
                }
            }));
        }
Exemplo n.º 29
0
        /// <summary>
        /// Load a Settings.
        /// </summary>
        /// <typeparam name="TSettings">The Generic of the Settings.</typeparam>
        /// <returns>Instanced <typeparamref name="TSettings"/></returns>
        /// <remarks>If the process is wrong, returns a default instanced <typeparamref name="TSettings"/></remarks>
        public TSettings LoadAutoSave <TSettings>() where TSettings : ISettings, INotifyPropertyChanged, new()
        {
            var exists = File.Exists(Path);

            if (exists)
            {
                try
                {
                    using (var sr = File.Open(Path, FileMode.Open))
                    {
                        var settings = (TSettings) new BinaryFormatter().Deserialize(sr);
                        settings.PropertyChanged += (s, e) =>
                        {
                            Save(settings);
                        };
                        return(settings);
                    }
                }
                catch
                {
                    var settings = new TSettings();
                    settings.PropertyChanged += (s, e) =>
                    {
                        Save(settings);
                    };
                    return(settings);
                }
            }
            else
            {
                var settings = new TSettings();
                settings.PropertyChanged += (s, e) =>
                {
                    Save(settings);
                };
                return(settings);
            }
        }
Exemplo n.º 30
0
        /// <summary>
        /// Write the result of a test run according to a spec.
        /// </summary>
        /// <param name="result">The test result</param>
        /// <param name="spec">An output specification</param>
        /// <param name="runSettings">Settings</param>
        /// <param name="filter">Filter</param>
        public void WriteResultFile(ITestResult result, OutputSpecification spec, IDictionary <string, object> runSettings, TestFilter filter)
        {
            //string outputPath = Path.Combine(_workDirectory, spec.OutputPath);
            // [DuongNT][BEGIN]: Get configured file path output
            // Write results log
            ResultSummary summary   = new ResultSummary(result);
            int           totalTCT  = summary.TestCount;
            int           passedTCT = summary.PassCount;
            int           failedTCT = summary.FailedCount;
            int           blockTCT  = totalTCT - passedTCT - failedTCT;

            TLogger.Write("");
            TLogger.Write("#####Summary#####");
            TLogger.Write("##### Total #####");
            TLogger.Write("#####   " + totalTCT + "   #####");
            TLogger.Write("##### PASS #####");
            TLogger.Write("#####   " + passedTCT + "   #####");
            TLogger.Write("##### FAIL #####");
            TLogger.Write("#####   " + failedTCT + "   #####");
            TLogger.Write("##### BLOCK #####");
            TLogger.Write("#####   " + blockTCT + "   #####");
            TLogger.Write("##### Details #####");
            TLogger.Write("");

            string outputPath = TSettings.GetInstance().GetOutputFilePathName();

            if (outputPath == "")
            {
                outputPath = Path.Combine(_workDirectory, spec.OutputPath);
            }
            TLogger.Write("Completed test-suite's execution!");
            TLogger.Write("Writing results to: " + outputPath + "...");
            // [DuongNT][END]: Get configured file path output

            OutputWriter outputWriter = null;

            switch (spec.Format)
            {
            case "nunit3":
                outputWriter = new NUnit3XmlOutputWriter();
                break;

            case "nunit2":
                outputWriter = new NUnit2XmlOutputWriter();
                break;

            //case "user":
            //    Uri uri = new Uri(Assembly.GetExecutingAssembly().CodeBase);
            //    string dir = Path.GetDirectoryName(uri.LocalPath);
            //    outputWriter = new XmlTransformOutputWriter(Path.Combine(dir, spec.Transform));
            //    break;

            default:
                throw new ArgumentException(
                          string.Format("Invalid XML output format '{0}'", spec.Format),
                          "spec");
            }

            outputWriter.WriteResultFile(result, outputPath, runSettings, filter);
            TLogger.Write("Results saved to: " + outputPath);
        }
Exemplo n.º 31
0
 public ServiceInstanceProviderBase(TSettings settings, Func <TSettings, TService> serviceFactory)
 {
     this.settings       = settings;
     this.serviceFactory = serviceFactory;
 }