Browse Source

Fixed tests

flabbet 5 years ago
parent
commit
6639849a7e

+ 2 - 1
PixiEditorTests/ModelsTests/ControllersTests/UndoManagerTests.cs

@@ -7,13 +7,14 @@ namespace PixiEditorTests.ModelsTests.ControllersTests
 {
     public class UndoManagerTests
     {
-
         public int ExampleProperty { get; set; } = 1;
         public TestPropertyClass TestPropClass { get; set; } = new TestPropertyClass();
 
         [Fact]
         public void TestSetRoot()
         {
+            PrepareUnoManagerForTest();
+            UndoManager.SetMainRoot(null);
             UndoManager.SetMainRoot(this);
             Assert.Equal(this, UndoManager.MainRoot);
         }

+ 1 - 12
PixiEditorTests/ModelsTests/ToolsTests/RectangleToolTests.cs

@@ -10,20 +10,9 @@ using Xunit;
 
 namespace PixiEditorTests.ModelsTests.ToolsTests
 {
+    [Collection("Application collection")]
     public class RectangleToolTests
     {
-        private bool _createdApp = false;
-
-        [ExcludeFromCodeCoverage]
-        public RectangleToolTests()
-        {
-            if (Application.Current == null && _createdApp == false)
-            {
-                var app = new App();
-                app.InitializeComponent();
-            }
-        }
-
         [StaTheory]
         [InlineData(0,0, 2,2)]
         [InlineData(0,0, 9, 9)]

+ 1 - 1
azure-pipelines.yml

@@ -35,7 +35,7 @@ steps:
   inputs:
     command: test
     projects: '**/*Tests/*.csproj'
-    arguments: '--configuration $(buildConfiguration)'
+    arguments: '--configuration $(buildConfiguration) --collect "Code coverage"'
 
 - task: PowerShell@2
   inputs: