Browse Source

Migrated unit test to xUnit.net and few bug fixes

 Bugs: drag viewport drawing, preview layer now works fully as dynamic layer
flabbet 5 years ago
parent
commit
d004c0883a

+ 39 - 14
PixiEditor/Models/Controllers/BitmapManager.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Linq;
+using System.Windows;
 using System.Windows.Input;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
@@ -80,7 +81,7 @@ namespace PixiEditor.Models.Controllers
 
         public void SetActiveTool(Tool tool)
         {
-            PreviewLayer?.Clear();
+            PreviewLayer = null;
             SelectedTool?.Toolbar.SaveToolbarSettings();
             SelectedTool = tool;
             SelectedTool.Toolbar.LoadSharedSettings();
@@ -131,7 +132,8 @@ namespace PixiEditor.Models.Controllers
 
         private void Controller_MousePositionChanged(object sender, MouseMovementEventArgs e)
         {
-            if (Mouse.LeftButton == MouseButtonState.Pressed && MouseController.ClickedOnCanvas && ActiveDocument != null)
+            if (Mouse.LeftButton == MouseButtonState.Pressed && !IsDraggingViewport()
+                                                             && MouseController.ClickedOnCanvas && ActiveDocument != null)
             {
                 if (IsOperationTool(SelectedTool))
                     BitmapOperations.ExecuteTool(e.NewPosition,
@@ -146,10 +148,15 @@ namespace PixiEditor.Models.Controllers
             }
         }
 
+        private bool IsDraggingViewport()
+        {
+            return Keyboard.IsKeyDown(Key.LeftShift);
+        }
+
         private void MouseController_StartedRecordingChanges(object sender, EventArgs e)
         {
             SelectedTool.OnMouseDown();
-            PreviewLayer?.Clear();
+            PreviewLayer = null;
         }
 
         private void MouseController_StoppedRecordingChanges(object sender, EventArgs e)
@@ -161,28 +168,46 @@ namespace PixiEditor.Models.Controllers
 
         public void GeneratePreviewLayer()
         {
-            if (PreviewLayer == null && ActiveDocument != null || PreviewLayerSizeMismatch())
-                PreviewLayer = new Layer("_previewLayer", ActiveDocument.Width, ActiveDocument.Height)
+            if (ActiveDocument != null)
+                PreviewLayer = new Layer("_previewLayer")
                 {
                     MaxWidth = ActiveDocument.Width,
                     MaxHeight = ActiveDocument.Height
                 };
         }
 
-        private bool PreviewLayerSizeMismatch()
-        {
-            return PreviewLayer.Width != ActiveDocument.Width || PreviewLayer.Height != ActiveDocument.Height;
-        }
-
         private void HighlightPixels(Coordinates newPosition)
         {
             if (ActiveDocument == null || ActiveDocument.Layers.Count == 0 || SelectedTool.HideHighlight) return;
-            GeneratePreviewLayer();
-            PreviewLayer.Clear();
             Coordinates[] highlightArea = CoordinatesCalculator.RectangleToCoordinates(
                 CoordinatesCalculator.CalculateThicknessCenter(newPosition, ToolSize));
-            PreviewLayer.ApplyPixels(
-                BitmapPixelChanges.FromSingleColoredArray(highlightArea, Color.FromArgb(77, 0, 0, 0)));
+            if (CanChangeHighlightOffset(highlightArea))
+            {
+                PreviewLayer.Offset = new Thickness(highlightArea[0].X, highlightArea[0].Y,0,0);
+            }
+            else if (!IsInsideBounds(highlightArea))
+            {
+                PreviewLayer = null;
+            }
+            else
+            {
+                GeneratePreviewLayer();
+                PreviewLayer.ApplyPixels(
+                    BitmapPixelChanges.FromSingleColoredArray(highlightArea, Color.FromArgb(77, 0, 0, 0)));
+            }
+        }
+
+        private bool CanChangeHighlightOffset(Coordinates[] highlightArea)
+        {
+            return highlightArea.Length > 0 && PreviewLayer != null && 
+                   IsInsideBounds(highlightArea) && highlightArea.Length == PreviewLayer.Width * PreviewLayer.Height;
+        }
+
+        private bool IsInsideBounds(Coordinates[] highlightArea)
+        {
+            return highlightArea[0].X <= ActiveDocument.Width - 1 &&
+                    highlightArea[0].Y <= ActiveDocument.Height - 1 &&
+                   highlightArea[^1].X >= 0 && highlightArea[^1].Y >= 0;
         }
 
         public WriteableBitmap GetCombinedLayersBitmap()

+ 0 - 1
PixiEditor/Models/Controllers/BitmapOperationsUtility.cs

@@ -149,7 +149,6 @@ namespace PixiEditor.Models.Controllers
             if (mouseMove.Count > 0 && mouseMove[0] != _lastMousePos)
             {
                 Manager.GeneratePreviewLayer();
-                Manager.PreviewLayer.Clear();
                 modifiedLayers = ((BitmapOperationTool) Manager.SelectedTool).Use(Manager.ActiveDocument.ActiveLayer,
                     mouseMove.ToArray(), Manager.PrimaryColor);
                 BitmapPixelChanges[] changes = modifiedLayers.Select(x => x.PixelChanges).ToArray();

+ 9 - 5
PixiEditor/Models/Layers/Layer.cs

@@ -11,6 +11,9 @@ namespace PixiEditor.Models.Layers
 {
     public class Layer : BasicLayer
     {
+
+        private const int SizeOfArgb = 4;
+
         public string Name
         {
             get => _name;
@@ -142,7 +145,8 @@ namespace PixiEditor.Models.Layers
                 Name = this.Name,
                 Offset = this.Offset,
                 MaxHeight = this.MaxHeight,
-                MaxWidth = this.MaxWidth
+                MaxWidth = this.MaxWidth,
+                Opacity = this.Opacity
             };
         }
 
@@ -345,6 +349,7 @@ namespace PixiEditor.Models.Layers
 
         private void IncreaseSizeToBottom(int newMaxX, int newMaxY)
         {
+            if (MaxWidth - OffsetX < 0 || MaxHeight - OffsetY < 0) return;
             newMaxX = Math.Clamp(Math.Max(newMaxX + 1, Width), 0, MaxWidth - OffsetX);
             newMaxY = Math.Clamp(Math.Max(newMaxY + 1, Height), 0, MaxHeight - OffsetY);
 
@@ -401,7 +406,6 @@ namespace PixiEditor.Models.Layers
 
         public void ResizeCanvas(int offsetX, int offsetY, int offsetXSrc, int offsetYSrc, int newWidth, int newHeight)
         {
-            int sizeOfArgb = 4;
             int iteratorHeight = Height > newHeight ? newHeight : Height;
             int count = Width > newWidth ? newWidth : Width;
 
@@ -412,9 +416,9 @@ namespace PixiEditor.Models.Layers
                 {
                     for (int line = 0; line < iteratorHeight; line++)
                     {
-                        var srcOff = ((offsetYSrc + line) * Width + offsetXSrc) * sizeOfArgb;
-                        var dstOff = ((offsetY + line) * newWidth + offsetX) * sizeOfArgb;
-                        BitmapContext.BlockCopy(srcContext, srcOff, destContext, dstOff, count * sizeOfArgb);
+                        var srcOff = ((offsetYSrc + line) * Width + offsetXSrc) * SizeOfArgb;
+                        var dstOff = ((offsetY + line) * newWidth + offsetX) * SizeOfArgb;
+                        BitmapContext.BlockCopy(srcContext, srcOff, destContext, dstOff, count * SizeOfArgb);
                     }
 
                     LayerBitmap = result;

+ 2 - 1
PixiEditor/Styles/ThemeStyle.xaml

@@ -2,7 +2,7 @@
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
 
     <Style TargetType="{x:Type Control}">
-        <Setter Property="Foreground" Value="Snow" />
+        <Setter Property="Foreground" Value="White" />
     </Style>
 
     <Style TargetType="Button" x:Key="BaseDarkButton">
@@ -162,6 +162,7 @@
         </Setter>
     </Style>
     <Style TargetType="MenuItem">
+        <Setter Property="Foreground" Value="White"/>
         <Setter Property="OverridesDefaultStyle" Value="True" />
         <Setter Property="Template">
             <Setter.Value>

+ 11 - 8
PixiEditor/Views/LayerItem.xaml

@@ -5,6 +5,7 @@
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:PixiEditor.Views"
              xmlns:converters="clr-namespace:PixiEditor.Helpers.Converters"
+             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
              mc:Ignorable="d" 
              d:DesignHeight="60" d:DesignWidth="250" Name="uc" MouseLeave="LayerItem_OnMouseLeave" MouseEnter="LayerItem_OnMouseEnter">
     <UserControl.Resources>
@@ -12,6 +13,13 @@
     </UserControl.Resources>
     <Border BorderThickness="1" BorderBrush="Gray" MinWidth="60"
             Background="{Binding IsActive, Mode=TwoWay, Converter={StaticResource BoolToColorConverter}}">
+        <i:Interaction.Triggers>
+            <i:EventTrigger EventName="MouseDown">
+                <i:InvokeCommandAction Command="{Binding ElementName=uc, 
+                            Path=SetActiveLayerCommand}"
+                                       CommandParameter="{Binding Path=LayerIndex, ElementName=uc}"/>
+            </i:EventTrigger>
+        </i:Interaction.Triggers>
         <Grid>
             <Grid.ColumnDefinitions>
                 <ColumnDefinition Width="35"/>
@@ -21,15 +29,10 @@
             <CheckBox VerticalAlignment="Center"
                       IsThreeState="False" HorizontalAlignment="Center"
                       IsChecked="{Binding Path=IsVisible, Mode=TwoWay}" Grid.Column="0" Height="16" />
-            <Button Background="Transparent" HorizontalAlignment="Center" VerticalAlignment="Center"
-                    Style="{StaticResource BaseDarkButton}" FontSize="16"
-                    Command="{Binding ElementName=uc, 
-                            Path=SetActiveLayerCommand}"
-                    CommandParameter="{Binding Path=LayerIndex, ElementName=uc}" Grid.Column="1">
-                <local:EditableTextBlock
-                    IsEditing="{Binding IsRenaming, ElementName=uc, Mode=TwoWay}"
+            <local:EditableTextBlock
+                    IsEditing="{Binding IsRenaming, ElementName=uc, Mode=TwoWay}" Grid.Column="1" FontSize="16" HorizontalAlignment="Center"
+                    VerticalAlignment="Center"
                     Text="{Binding LayerName, ElementName=uc, Mode=TwoWay}" />
-            </Button>
             <StackPanel Visibility="{Binding Path=ControlButtonsVisible, ElementName=uc}" 
                         Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" Width="15" 
                         Grid.Column="2">

+ 4 - 3
PixiEditor/Views/MainWindow.xaml

@@ -121,8 +121,8 @@
                         Command="{x:Static SystemCommands.CloseWindowCommand}" />
             </StackPanel>
         </DockPanel>
-        <StackPanel Background="{StaticResource AccentColor}" Orientation="Horizontal" Grid.ColumnSpan="3"
-                    Margin="0,30,146,0" Grid.RowSpan="2">
+        <StackPanel Background="{StaticResource AccentColor}" Orientation="Horizontal" Grid.ColumnSpan="3" Grid.Column="0"
+                    Margin="0,30,146,0" Grid.Row="0" Grid.RowSpan="2">
             <ItemsControl ItemsSource="{Binding BitmapManager.SelectedTool.Toolbar.Settings}">
                 <ItemsControl.ItemsPanel>
                     <ItemsPanelTemplate>
@@ -174,7 +174,8 @@
                             <Image Source="{Binding BitmapManager.PreviewLayer.LayerBitmap}" Panel.ZIndex="2"
                                    RenderOptions.BitmapScalingMode="NearestNeighbor" Stretch="Uniform"
                                    Width="{Binding BitmapManager.PreviewLayer.Width}"
-                                   Height="{Binding BitmapManager.PreviewLayer.Height}" />
+                                   Height="{Binding BitmapManager.PreviewLayer.Height}" 
+                                   Margin="{Binding BitmapManager.PreviewLayer.Offset}"/>
                             <ItemsControl ItemsSource="{Binding BitmapManager.ActiveDocument.Layers}">
                                 <ItemsControl.ItemsPanel>
                                     <ItemsPanelTemplate>

+ 15 - 16
PixiEditorTests/ModelsTests/ControllersTests/UndoManagerTests.cs

@@ -1,62 +1,61 @@
-using NUnit.Framework;
-using PixiEditor.Models.Controllers;
+using PixiEditor.Models.Controllers;
 using PixiEditor.Models.DataHolders;
+using Xunit;
 
 namespace PixiEditorTests.ModelsTests.ControllersTests
 {
-    [TestFixture]
     public class UndoManagerTests
     {
 
         public int ExampleProperty { get; set; } = 1;
 
-        [TestCase]
+        [Fact]
         public void TestSetRoot()
         {
             UndoManager.SetMainRoot(this);
-            Assert.AreEqual(this, UndoManager.MainRoot);
+            Assert.Equal(this, UndoManager.MainRoot);
         }
 
-        [TestCase]
+        [Fact]
         public void TestAddToUndoStack()
         {
             PrepareUnoManagerForTests();
             UndoManager.AddUndoChange(new Change("ExampleProperty", ExampleProperty, ExampleProperty));
-            Assert.IsTrue(UndoManager.UndoStack.Count == 1);
-            Assert.IsTrue((int)UndoManager.UndoStack.Peek().OldValue == ExampleProperty);
+            Assert.True(UndoManager.UndoStack.Count == 1);
+            Assert.True((int)UndoManager.UndoStack.Peek().OldValue == ExampleProperty);
         }
 
-        [TestCase]
+        [Fact]
         public void TestThatUndoAddsToRedoStack()
         {
             PrepareUnoManagerForTests();
             UndoManager.AddUndoChange(new Change("ExampleProperty", ExampleProperty, ExampleProperty));
             UndoManager.Undo();
-            Assert.IsTrue(UndoManager.RedoStack.Count == 1);
+            Assert.True(UndoManager.RedoStack.Count == 1);
         }
 
-        [TestCase]
+        [Fact]
         public void TestUndo()
         {
             PrepareUnoManagerForTests();
             UndoManager.AddUndoChange(new Change("ExampleProperty", ExampleProperty, 55));
             ExampleProperty = 55;
             UndoManager.Undo();
-            Assert.IsTrue((int)UndoManager.RedoStack.Peek().OldValue == ExampleProperty);
+            Assert.True((int)UndoManager.RedoStack.Peek().OldValue == ExampleProperty);
         }
 
 
-        [TestCase]
+        [Fact]
         public void TestThatRedoAddsToUndoStack()
         {
             PrepareUnoManagerForTests();
             UndoManager.AddUndoChange(new Change("ExampleProperty", ExampleProperty, ExampleProperty));
             UndoManager.Undo();
             UndoManager.Redo();
-            Assert.IsTrue(UndoManager.UndoStack.Count == 1);
+            Assert.True(UndoManager.UndoStack.Count == 1);
         }
 
-        [TestCase]
+        [Fact]
         public void TestRedo()
         {
             PrepareUnoManagerForTests();
@@ -64,7 +63,7 @@ namespace PixiEditorTests.ModelsTests.ControllersTests
             UndoManager.AddUndoChange(new Change("ExampleProperty", 1, ExampleProperty));
             UndoManager.Undo();
             UndoManager.Redo();
-            Assert.IsTrue((int)UndoManager.UndoStack.Peek().NewValue == ExampleProperty);
+            Assert.True((int)UndoManager.UndoStack.Peek().NewValue == ExampleProperty);
         }
 
         private void PrepareUnoManagerForTests()

+ 8 - 8
PixiEditorTests/ModelsTests/PositionTests/CoordinatesCalculatorTests.cs

@@ -1,19 +1,19 @@
-using NUnit.Framework;
-using PixiEditor.Models.Position;
+using PixiEditor.Models.Position;
+using Xunit;
 
 namespace PixiEditorTests.ModelsTests.PositionTests
 {
-    [TestFixture]
     public class CoordinatesCalculatorTests
     {
-        [TestCase(0, 0, 3, 3, 1, 1)]
-        [TestCase(0, 0, 2, 2, 1, 1)]
-        [TestCase(5, 5, 7, 7, 6, 6)]
-        [TestCase(5, 5, 9, 9, 7, 7)]
+        [Theory]
+        [InlineData(0, 0, 3, 3, 1, 1)]
+        [InlineData(0, 0, 2, 2, 1, 1)]
+        [InlineData(5, 5, 7, 7, 6, 6)]
+        [InlineData(5, 5, 9, 9, 7, 7)]
         public void TestGetCenter(int x1, int y1, int x2, int y2, int expectedX, int expectedY)
         {
             Coordinates center = CoordinatesCalculator.GetCenterPoint(new Coordinates(x1, y1), new Coordinates(x2, y2));
-            Assert.AreEqual(new Coordinates(expectedX, expectedY), center);
+            Assert.Equal(new Coordinates(expectedX, expectedY), center);
         }
 
     }

+ 3 - 3
PixiEditorTests/PixiEditorTests.csproj

@@ -11,12 +11,12 @@
       <PrivateAssets>all</PrivateAssets>
       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
     </PackageReference>
-    <PackageReference Include="nunit" Version="3.12.0" />
-    <PackageReference Include="NUnit3TestAdapter" Version="3.16.1">
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
+    <PackageReference Include="xunit" Version="2.4.1" />
+    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.2">
       <PrivateAssets>all</PrivateAssets>
       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
     </PackageReference>
-    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
   </ItemGroup>
 
   <ItemGroup>

+ 24 - 23
PixiEditorTests/WorkspaceTests/ColorsTests/ExtendedColorTests.cs

@@ -1,62 +1,63 @@
-using NUnit.Framework;
-using PixiEditor.Models.Colors;
+using PixiEditor.Models.Colors;
 using System;
 using System.Windows.Media;
+using Xunit;
 
 namespace PixiEditorTests.WorkspaceTests.ColorsTests
 {
-    [TestFixture]
     public class ExtendedColorTests
     {
         private const int AcceptableMaringOfError = 1;
 
-        [TestCase()]
+        [Fact]
         public void ChangeColorBrightnessIsNotTheSameTest()
         {
             Color newColor = ExColor.ChangeColorBrightness(Colors.White, -1);
-            Assert.AreNotEqual(Colors.White, newColor);
+            Assert.NotEqual(Colors.White, newColor);
         }
 
-        [TestCase()]
+        [Fact]
         public void ChangeColorBrightnessNewValueTest()
         {
             Color newColor = ExColor.ChangeColorBrightness(Colors.White, -100);
-            Assert.AreEqual(Colors.Black, newColor);
+            Assert.Equal(Colors.Black, newColor);
         }
 
 
         //Acceptable margin of error is 1
-        [TestCase(0, 0, 0, 0, 0, 0)]
-        [TestCase(255, 255, 255, 0, 0, 100)]
-        [TestCase(182, 55, 55, 0, 53.6f, 46.5f)]
-        [TestCase(20, 47, 255, 233, 100, 53.9f)]
-        [TestCase(137, 43, 226, 271, 75.9f, 52.7f)]
+        [Theory]
+        [InlineData(0, 0, 0, 0, 0, 0)]
+        [InlineData(255, 255, 255, 0, 0, 100)]
+        [InlineData(182, 55, 55, 0, 53.6f, 46.5f)]
+        [InlineData(20, 47, 255, 233, 100, 53.9f)]
+        [InlineData(137, 43, 226, 271, 75.9f, 52.7f)]
         public void RgbToHslTest(int r, int g, int b, int h, float s, float l)
         {
             Tuple<int, float, float> hsl = ExColor.RgbToHsl(r, g, b);
             float marginOfErrorH = Math.Abs(hsl.Item1 - h);
             float marginOfErrorS = Math.Abs(hsl.Item2 - s);
             float marginOfErrorL = Math.Abs(hsl.Item3 - l);
-            Assert.LessOrEqual(marginOfErrorH, AcceptableMaringOfError);
-            Assert.LessOrEqual(marginOfErrorS, AcceptableMaringOfError);
-            Assert.LessOrEqual(marginOfErrorL, AcceptableMaringOfError);
+            Assert.True(marginOfErrorH <= AcceptableMaringOfError);
+            Assert.True(marginOfErrorS <= AcceptableMaringOfError);
+            Assert.True(marginOfErrorL <= AcceptableMaringOfError);
 
         }
 
-        [TestCase(0, 0, 0, 0, 0, 0)]
-        [TestCase(0, 0, 100, 255, 255, 255)]
-        [TestCase(0, 53.6f, 46.5f, 182, 55, 55)]
-        [TestCase(297, 100, 17.1f, 82, 0, 87)]
-        [TestCase(271, 75.9f, 52.7f, 137, 43, 226)]
+        [Theory]
+        [InlineData(0, 0, 0, 0, 0, 0)]
+        [InlineData(0, 0, 100, 255, 255, 255)]
+        [InlineData(0, 53.6f, 46.5f, 182, 55, 55)]
+        [InlineData(297, 100, 17.1f, 82, 0, 87)]
+        [InlineData(271, 75.9f, 52.7f, 137, 43, 226)]
         public void HslToRgbTest(int h, float s, float l, int r, int g, int b)
         {
             Color rgb = ExColor.HslToRGB(h, s, l);
             int marginOfErrorR = Math.Abs(rgb.R - r);
             int marginOfErrorG = Math.Abs(rgb.G - g);
             int marginOfErrorB = Math.Abs(rgb.B - b);
-            Assert.LessOrEqual(marginOfErrorR, AcceptableMaringOfError);
-            Assert.LessOrEqual(marginOfErrorG, AcceptableMaringOfError);
-            Assert.LessOrEqual(marginOfErrorB, AcceptableMaringOfError);
+            Assert.True(marginOfErrorR <= AcceptableMaringOfError);
+            Assert.True(marginOfErrorG <= AcceptableMaringOfError);
+            Assert.True(marginOfErrorB <= AcceptableMaringOfError);
 
         }
     }

+ 0 - 22
PixiEditorTests/WorkspaceTests/ImageGeneratorTests.cs

@@ -1,22 +0,0 @@
-using NUnit.Framework;
-using PixiEditor.Models.Images;
-using System.Windows.Controls;
-using System.Windows.Media;
-
-namespace PixiEditorTests.ToolsTests
-{
-    [TestFixture, Apartment(System.Threading.ApartmentState.STA)]
-    public class ImageGeneratorTests
-    {
-        [TestCase(16, 16)]
-        [TestCase(1024, 12)]
-        [TestCase(50000, 50000)]
-        public void ImageIsPixelArtReady(int width, int height)
-        {
-            Image img = ImageGenerator.GenerateForPixelArts(width, height);
-
-            Assert.IsTrue(img.Stretch == Stretch.Uniform && RenderOptions.GetBitmapScalingMode(img) == BitmapScalingMode.NearestNeighbor
-                && RenderOptions.GetEdgeMode(img) == EdgeMode.Aliased && img.Width == width && img.Height == height);
-        }
-    }
-}

+ 17 - 17
PixiEditorTests/WorkspaceTests/ToolsTests/CoordinatesCalculatorTests.cs

@@ -1,38 +1,38 @@
-using NUnit.Framework;
-using PixiEditor.Models.Position;
+using PixiEditor.Models.Position;
+using Xunit;
 
 namespace PixiEditorTests.WorkspaceTests.ToolsTests
 {
-    [TestFixture]
     public class CoordinatesCalculatorTests
     {
-        [TestCase(0, 0, 2, 2, ExpectedResult = 9)]
-        [TestCase(0, 0, 10, 10, ExpectedResult = 121)]
-        public int RectangleToCoordinatesAmountTest(int x1, int y1, int x2, int y2)
+        [Theory]
+        [InlineData(0, 0, 2, 2, 9)]
+        [InlineData(0, 0, 10, 10, 121)]
+        public void RectangleToCoordinatesAmountTest(int x1, int y1, int x2, int y2, int expectedResult)
         {
-            return CoordinatesCalculator.RectangleToCoordinates(x1, y1, x2, y2).Length;
+            Assert.Equal(CoordinatesCalculator.RectangleToCoordinates(x1, y1, x2, y2).Length, expectedResult);
         }
 
-        [TestCase()]
+        [Fact]
         public void CalculateSquareEvenThicknessCenterTest()
         {
             DoubleCords cords = CoordinatesCalculator.CalculateThicknessCenter(new Coordinates(3, 3), 4);
 
-            Assert.AreEqual(1, cords.Coords1.X);
-            Assert.AreEqual(1, cords.Coords1.Y);
-            Assert.AreEqual(4, cords.Coords2.X);
-            Assert.AreEqual(4, cords.Coords2.Y);
+            Assert.Equal(1, cords.Coords1.X);
+            Assert.Equal(1, cords.Coords1.Y);
+            Assert.Equal(4, cords.Coords2.X);
+            Assert.Equal(4, cords.Coords2.Y);
         }
 
-        [TestCase()]
+        [Fact]
         public void CalculateSquareOddThicknessCenterTest()
         {
             DoubleCords cords = CoordinatesCalculator.CalculateThicknessCenter(new Coordinates(3, 3), 3);
 
-            Assert.AreEqual(2, cords.Coords1.X);
-            Assert.AreEqual(2, cords.Coords1.Y);
-            Assert.AreEqual(4, cords.Coords2.X);
-            Assert.AreEqual(4, cords.Coords2.Y);
+            Assert.Equal(2, cords.Coords1.X);
+            Assert.Equal(2, cords.Coords1.Y);
+            Assert.Equal(4, cords.Coords2.X);
+            Assert.Equal(4, cords.Coords2.Y);
         }
     }
 }