コード例 #1
0
ファイル: Examination.cs プロジェクト: TahaR9/DesingPatterns
 public override void Create()
 {
     Tests.Add(new Assignment("Assignment - 1"));
     Tests.Add(new Assignment("Assignment - 2"));
     Tests.Add(new Assignment("Assignment - 3"));
     Tests.Add(new Assignment("Assignment - 4"));
 }
コード例 #2
0
        public void Add(string tool, string test, object result)
        {
            test = ExtractIndent(test, true);
            if (!Tools.Contains(tool))
            {
                Tools.Add(tool);
            }
            if (!Tests.Contains(test))
            {
                Tests.Add(test);
            }
            var    key = new Pair <string, string>(test, tool);
            object prevResult;

            if (Results.TryGetValue(key, out prevResult))
            {
                // This allows to run the same test for multiple times
                // and pick up the best result.
                if (prevResult is int && result is int)
                {
                    Results[key] = Math.Max((int)prevResult, (int)result);
                }
            }
            else
            {
                Results.Add(key, result);
            }
        }
コード例 #3
0
        private void LoadTests(object sender, RoutedEventArgs e)
        {
            DTE dte;

            dte = (EnvDTE.DTE)Package.GetGlobalService(typeof(EnvDTE.DTE));
            var solutionPath = dte.Solution.FileName;

            if (string.IsNullOrWhiteSpace(solutionPath))
            {
                this.lblFilePath.Content    = "No project / solution open";
                this.lblFilePath.Background = new SolidColorBrush(Colors.Red);
                return;
            }
            // find the yaml file
            YamlFIlePath = Directory.GetFiles(Path.GetDirectoryName(solutionPath), "*.yaml").FirstOrDefault();

            if (string.IsNullOrEmpty(YamlFIlePath))
            {
                this.lblFilePath.Content    = "No file found";
                this.lblFilePath.Background = new SolidColorBrush(Colors.Red);
                return;
            }

            this.lblFilePath.Content    = Path.GetFileName(YamlFIlePath);
            this.lblFilePath.Background = new SolidColorBrush(Colors.Transparent);

            var yamlParser = new YamlFileParser(YamlFIlePath);

            foreach (var testModel in yamlParser.Parse())
            {
                Tests.Add(testModel);
            }
            yamlParser.Parse();
        }
コード例 #4
0
 protected override void OnCreateTests()
 {
     foreach (var test in tests)
     {
         Tests.Add(test);
     }
 }
コード例 #5
0
 public TestSuite()
 {
     Tests.Add(new Marshaller.TestMarshaller());
     Tests.Add(new Unmarshaller.TestUnmarshaller());
     Tests.Add(new DayTracker.TestDayTracker());
     Tests.Add(new TimeStruct.TestTimeStruct());
 }
コード例 #6
0
        protected override async void OnCreateTests()
        {
            try {
                AddOldTests();
                Status = TestStatus.Loading;

                var discoveredTests = await VsTestDiscoveryAdapter.Instance.DiscoverTestsAsync(Project);

                var tests = discoveredTests.BuildTestInfo(this);

                Status = TestStatus.Ready;

                Tests.Clear();

                foreach (UnitTest test in tests)
                {
                    Tests.Add(test);
                }

                OnTestChanged();
            } catch (Exception e) {
                LoggingService.LogError("Failed to discover unit tests.", e);
                Status = TestStatus.LoadError;
            }
        }
コード例 #7
0
ファイル: Examination.cs プロジェクト: TahaR9/DesingPatterns
 public override void Create()
 {
     Tests.Add(new Quiz("Quiz - 1"));
     Tests.Add(new Quiz("Quiz - 2"));
     Tests.Add(new Quiz("Quiz - 3"));
     Tests.Add(new Quiz("Quiz - 4"));
 }
コード例 #8
0
        protected override void OnCreateTests()
        {
            lock (locker)
            {
                if (Status == TestStatus.Loading)
                {
                    return;
                }

                var testInfo = cache.GetTestInfo();
                if (testInfo != null)
                {
                    FillTests(testInfo);
                    return;
                }

                Status = TestStatus.Loading;
            }

            lastAssemblyTime = GetAssemblyTime();

            if (oldList != null)
            {
                foreach (UnitTest t in oldList)
                {
                    Tests.Add(t);
                }
            }

            loader.AsyncLoadTestInfo(this, cache);
        }
コード例 #9
0
        public Tests DataModelSerializerFactory_StructuralTypeCycle_Tests()
        {
            var maxDepth  = 5;
            var instances = new OuterCycleType[maxDepth * 2];

            instances[0] = new OuterCycleType();
            for (var i = 1; i < maxDepth * 2; ++i)
            {
                instances[i] = new OuterCycleType
                {
                    Inner = new InnerCycleType
                    {
                        Outer      = instances[i - 1],
                        OuterArray = new[] { instances[i - 1] },
                        OuterList  = new List <OuterCycleType> {
                            instances[i - 1]
                        },
                    }
                };
            }

            var minDepth = 1;
            var tests    = new Tests();

            for (var i = minDepth - 1; i < maxDepth; ++i)
            {
                tests.Add("new OuterCycleType(/* depth = " + i + " */)", typeof(OuterCycleType), instances[i], DataTypeObjectEqualityComparer.Default);
            }

            return(tests);
        }
コード例 #10
0
        void FillTests(NunitTestInfo ti)
        {
            if (ti.Tests == null)
            {
                return;
            }

            foreach (NunitTestInfo test in ti.Tests)
            {
                var newTest = new NUnitTestSuite(this, test);
                newTest.FixtureTypeName      = test.FixtureTypeName;
                newTest.FixtureTypeNamespace = test.FixtureTypeNamespace;

                newTest.ChildStatus(test, out bool isNamespace, out bool hasClassAsChild);

                if (!isNamespace || hasClassAsChild)
                {
                    Tests.Add(newTest);
                }

                var forceLoad = newTest.Tests;
                foreach (NUnitTestSuite child in newTest.ChildNamespaces)
                {
                    child.Title = newTest.Title + "." + child.Title;
                    Tests.Add(child);
                }
            }
            oldList = new UnitTest [Tests.Count];
            Tests.CopyTo(oldList, 0);
        }
コード例 #11
0
 public void AddTest(BaseTest test)
 {
     if (!Tests.Any(t => t.TestTitle == test.TestTitle))
     {
         Tests.Add(test);
     }
 }
コード例 #12
0
ファイル: TestRepository.cs プロジェクト: Felicci/Pos4xhif
        /// <summary>
        /// Ruft PUT /api/test/id mit dem übergebenen Testobjekt auf.
        /// Löscht danach das Objekt aus der ObservableCollection und fügt das vom Server gelieferte
        /// neue Testobjekt hinzu.
        /// </summary>
        /// <param name="id">Die ID des Testes, die für den HTTP Request verwendet wird.</param>
        /// <param name="test">Die neuen Daten des Testes.</param>
        /// <returns></returns>
        public async Task Update(TestDto test)
        {
            TestDto newTest = await RestService.Instance.SendAsync <TestDto>(HttpMethod.Put, "test", test.TestId.ToString(), test);

            Tests.Remove(test);
            Tests.Add(newTest);
        }
コード例 #13
0
 public override void Setup()
 {
     Tests.Add(new UpdateQualityNoMerge());
     Tests.Add(new UpdateStuffNoMerge());
     Tests.Add(new UpdateQualityAndMerged());
     Tests.Add(new UpdateStuffAndMerged());
     Tests.Add(new UpdateHitPoint());
 }
コード例 #14
0
 public override void Setup()
 {
     // Add tests
     Tests.Add(new RemoveOneItem());
     Tests.Add(new RemoveSameItemTwice());
     Tests.Add(new RemoveAllButOne());
     Tests.Add(new RemoveAll());
 }
コード例 #15
0
		protected override void OnCreateTests ()
		{
			NUnitAssemblyGroupProjectConfiguration conf = (NUnitAssemblyGroupProjectConfiguration) project.GetConfiguration ((ItemConfigurationSelector) ActiveConfiguration);
			if (conf != null) {
				foreach (TestAssembly t in conf.Assemblies)
					Tests.Add (t);
			}
		}
コード例 #16
0
        public async Task ProcessTestsByCourseId(int courseId)
        {
            var service = new TestService();
            var result  = await service.GetTestsByCourseId(courseId);

            Tests = TestPresenter.GetTestPresenters(result);
            Tests.Add(new NewTestPresenter());
        }
コード例 #17
0
ファイル: TestListManager.cs プロジェクト: jeason0813/NBi
 public void SetTests(IEnumerable <Test> tests)
 {
     Tests.Clear();
     foreach (var testDto in tests)
     {
         Tests.Add(testDto.Reference);
     }
 }
コード例 #18
0
 private void HandleTestsRefreshed(object sender, EventArgs args)
 {
     Tests.Clear();
     foreach (var test in testEngine.Tests.Select(test => new TestMethodViewModel(test)))
     {
         Tests.Add(test);
     }
     RefreshProgressBarColor();
 }
コード例 #19
0
 public override void Setup()
 {
     // Add tests
     Tests.Add(new AddOneItem());
     Tests.Add(new AddUnmergeableItemTwice());
     Tests.Add(new AddTwoThingsDifferentInStuff());
     Tests.Add(new AddTwoThingsDifferentInQuality());
     Tests.Add(new AddMergeableItemTwice());
 }
コード例 #20
0
        private void AddTestToList()
        {
            ITest         test = _dao.CreateNewTest();
            TestViewModel qvm  = new TestViewModel(test);

            _dao.AddTest(test);
            Tests.Add(qvm);
            EditedTest = qvm;
        }
コード例 #21
0
        public async Task LoadTestsAsync()
        {
            IsBusy = true;
            // Factories
            var factoriesResult = await Task.Run(() =>
            {
                List <FactoryViewModel> factories = new List <FactoryViewModel>();
                foreach (var factory in _engine.GetProviderFactories())
                {
                    var vm = new FactoryViewModel
                    {
                        Factory = factory
                    };
                    try
                    {
                        using (var provider = vm.Factory.CreateProvider())
                            vm.Version = provider.GetVersion();
                    }
                    catch (Exception ex)
                    {
                        vm.Version = $"ERR: {ex.Message}";
                    }
                    factories.Add(vm);
                }
                return(factories);
            });

            Factories.Clear();
            foreach (var f in factoriesResult)
            {
                Factories.Add(f);
            }
            // Tests
            var testsResult = await Task.Run(() =>
            {
                List <TestViewModel> tests = new List <TestViewModel>();
                foreach (var test in _engine.GetTests())
                {
                    var vm = new TestViewModel
                    {
                        Test       = test,
                        IsSelected = true
                    };
                    tests.Add(vm);
                }
                return(tests);
            });

            Tests.Clear();
            foreach (var t in testsResult)
            {
                Tests.Add(t);
            }

            IsBusy = false;
        }
コード例 #22
0
 protected internal void Include(Stream stream)
 {
     using (StreamReader reader = new StreamReader(stream, Encoding.UTF8, true))
     {
         var str  = reader.ReadToEnd();
         var test = XmlDeserializeFromString <TestStandaloneXml>(str);
         test.Content = XmlSerializeFrom(test);
         Tests.Add(test);
     }
 }
コード例 #23
0
 void AddOldTests()
 {
     if (oldTests != null)
     {
         foreach (var test in oldTests)
         {
             Tests.Add(test);
         }
     }
 }
コード例 #24
0
 public static void StartTest(string test_name, string test_description = "no description")
 {
     _current_test = test_name;
     Console.WriteLine("Started Test: {0}", test_name);
     Console.WriteLine();
     Console.WriteLine(test_description);
     Console.WriteLine();
     Console.WriteLine("Additional Output of your tested program:");
     Tests.Add(new TestElement(test_name));
 }
コード例 #25
0
        protected override void OnCreateTests()
        {
            lock (locker) {
                if (Status == TestStatus.Loading)
                {
                    return;
                }

                NunitTestInfo ti = testInfoCache.GetInfo(AssemblyPath);
                if (ti != null)
                {
                    FillTests(ti);
                    return;
                }

                Status = TestStatus.Loading;
            }

            lastAssemblyTime = GetAssemblyTime();

            if (oldList != null)
            {
                foreach (UnitTest t in oldList)
                {
                    Tests.Add(t);
                }
            }

            OnTestStatusChanged();

            LoadData ld = new LoadData();

            ld.Path = AssemblyPath;
            ld.TestInfoCachePath = cacheLoaded ? null : TestInfoCachePath;
            ld.Callback          = delegate {
                Runtime.RunInMainThread(delegate {
                    if (ld.Error != null)
                    {
                        this.ErrorMessage = ld.Error.Message;
                    }
                    else
                    {
                        ErrorMessage = string.Empty;
                    }
                    AsyncCreateTests(ld);
                });
            };
            ld.SupportAssemblies = GetSupportAssembliesAsync();
            ld.NUnitVersion      = NUnitVersion;

            AsyncLoadTest(ld);

            // Read the cache from disk only once
            cacheLoaded = true;
        }
コード例 #26
0
 protected override void OnCreateTests()
 {
     foreach (SolutionFolderItem e in folder.Items)
     {
         UnitTest t = UnitTestService.BuildTest(e);
         if (t != null)
         {
             Tests.Add(t);
         }
     }
 }
コード例 #27
0
 public override void Setup()
 {
     if (GetType() == typeof(Test_UpdateForNewLoadout))
     {
         Tests.Add(new AssignLoadoutToNull());
         Tests.Add(new NewLoadoutHasOneMoreThing());
         Tests.Add(new NewLoadoutHasOneLessThing());
         Tests.Add(new DifferentInStackCount());
         Tests.Add(new UpdateLoadoutWithInventory());
     }
 }
コード例 #28
0
 public async Task LoadTests()
 {
     this.Tests.Clear();
     await Task.Run(() =>
     {
         foreach (var test in Target.GetType().GetCustomAttributes <TargetTestAttribute>(true))
         {
             Tests.Add(TestViewModelFactory.Create(test.TestType, this.Target));
         }
     });
 }
コード例 #29
0
 protected override void OnCreateTests()
 {
     foreach (WorkspaceItem e in workspace.Items)
     {
         UnitTest t = UnitTestService.BuildTest(e);
         if (t != null)
         {
             Tests.Add(t);
         }
     }
 }
コード例 #30
0
        public virtual bool OnMessage(IMessageSinkMessage message)
        {
            switch (message)
            {
            case ITestCaseDiscoveryMessage testCaseDiscoveryMessage:
                var testClass = testCaseDiscoveryMessage.TestClass.Class;
                if (testClass.IsAbstract)
                {
                    return(true);
                }
#if CORECLR
                var specType = testCaseDiscoveryMessage.TestAssembly.Assembly.GetType(testClass.Name).ToRuntimeType();
#else
                var testAssembly = Assembly.LoadFrom(testCaseDiscoveryMessage.TestAssembly.Assembly.AssemblyPath);
                var specType     = testAssembly.GetType(testClass.Name);
#endif
                var roles = RoleNames(specType);

                var details = roles.Select((r, i) => new NodeTest
                {
                    Node       = i + 1,
                    Role       = r.Name,
                    TestName   = testClass.Name,
                    TypeName   = testClass.Name,
                    MethodName = testCaseDiscoveryMessage.TestCase.TestMethod.Method.Name,
                    SkipReason = testCaseDiscoveryMessage.TestCase.SkipReason,
                }).ToList();
                if (details.Any())
                {
                    var dictKey = details.First().TestName;
                    if (Tests.ContainsKey(dictKey))
                    {
                        Tests[dictKey].AddRange(details);
                    }
                    else
                    {
                        Tests.Add(dictKey, details);
                    }
                }
                break;

            case IDiscoveryCompleteMessage discoveryComplete:
                Finished.Set();
                break;

            case ErrorMessage err:
                Errors.Add(err);
                break;
            }

            return(true);
        }