Skip to content

Commit 9e6de23

Browse files
committed
Final FluentAssertion removed from chunk3 files
1 parent a612d8e commit 9e6de23

File tree

7 files changed

+156
-163
lines changed

7 files changed

+156
-163
lines changed

tests/Blazor.Diagrams.Core.Tests/Blazor.Diagrams.Core.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="FluentAssertions" />
1110
<PackageReference Include="Microsoft.NET.Test.Sdk" />
1211
<PackageReference Include="xunit" />
1312
<PackageReference Include="Moq" />

tests/Blazor.Diagrams.Core.Tests/Layers/GroupLayerTests.cs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Blazor.Diagrams.Core.Models;
2-
using FluentAssertions;
32
using System;
43
using Xunit;
54

@@ -24,7 +23,7 @@ public void Group_ShouldCallFactoryThenAddMethod()
2423
diagram.Groups.Group(Array.Empty<NodeModel>());
2524

2625
// Assert
27-
factoryCalled.Should().BeTrue();
26+
Assert.True(factoryCalled);
2827
}
2928

3029
[Fact]
@@ -42,7 +41,7 @@ public void Remove_ShouldRemoveAllPortLinks()
4241
diagram.Groups.Remove(group);
4342

4443
// Assert
45-
diagram.Links.Should().BeEmpty();
44+
Assert.Empty(diagram.Links);
4645
}
4746

4847
[Fact]
@@ -58,7 +57,7 @@ public void Remove_ShouldRemoveAllLinks()
5857
diagram.Groups.Remove(group);
5958

6059
// Assert
61-
diagram.Links.Should().BeEmpty();
60+
Assert.Empty(diagram.Links);
6261
}
6362

6463
[Fact]
@@ -73,8 +72,8 @@ public void Remove_ShouldRemoveItselfFromParentGroup()
7372
diagram.Groups.Remove(group1);
7473

7574
// Assert
76-
group2.Children.Should().BeEmpty();
77-
group1.Group.Should().BeNull();
75+
Assert.Empty(group2.Children);
76+
Assert.Null(group1.Group);
7877
}
7978

8079
[Fact]
@@ -89,8 +88,8 @@ public void Remove_ShouldUngroup()
8988
diagram.Groups.Remove(group);
9089

9190
// Assert
92-
group.Children.Should().BeEmpty();
93-
node.Group.Should().BeNull();
91+
Assert.Empty(group.Children);
92+
Assert.Null(node.Group);
9493
}
9594

9695
[Fact]
@@ -105,7 +104,7 @@ public void Delete_ShouldDeleteChildGroup()
105104
diagram.Groups.Delete(group2);
106105

107106
// Assert
108-
diagram.Groups.Should().BeEmpty();
107+
Assert.Empty(diagram.Groups);
109108
}
110109

111110
[Fact]
@@ -120,8 +119,8 @@ public void Delete_ShouldRemoveChild()
120119
diagram.Groups.Delete(group);
121120

122121
// Assert
123-
diagram.Groups.Should().BeEmpty();
124-
diagram.Nodes.Should().BeEmpty();
122+
Assert.Empty(diagram.Groups);
123+
Assert.Empty(diagram.Nodes);
125124
}
126125

127126
[Fact]
@@ -136,7 +135,7 @@ public void Add_ShouldRefreshDiagramOnce()
136135
var group = diagram.Groups.Add(new GroupModel(Array.Empty<NodeModel>()));
137136

138137
// Assert
139-
refreshes.Should().Be(1);
138+
Assert.Equal(1, refreshes);
140139
}
141140

142141
[Fact]
@@ -152,7 +151,7 @@ public void Remove_ShouldRefreshDiagramOnce()
152151
diagram.Groups.Remove(group);
153152

154153
// Assert
155-
refreshes.Should().Be(1);
154+
Assert.Equal(1,refreshes);
156155
}
157156

158157
[Fact]
@@ -169,6 +168,6 @@ public void Delete_ShouldRefreshDiagramOnce()
169168
diagram.Groups.Delete(group);
170169

171170
// Assert
172-
refreshes.Should().Be(1);
171+
Assert.Equal(1,refreshes);
173172
}
174173
}

tests/Blazor.Diagrams.Core.Tests/Layers/NodeLayerTests.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Blazor.Diagrams.Core.Models;
2-
using FluentAssertions;
32
using Xunit;
43

54
namespace Blazor.Diagrams.Core.Tests.Layers;
@@ -21,7 +20,7 @@ public void Remove_ShouldRemoveAllPortLinks()
2120
diagram.Nodes.Remove(node1);
2221

2322
// Assert
24-
diagram.Links.Should().BeEmpty();
23+
Assert.Empty(diagram.Links);
2524
}
2625

2726
[Fact]
@@ -37,7 +36,7 @@ public void Remove_ShouldRemoveAllLinks()
3736
diagram.Nodes.Remove(node1);
3837

3938
// Assert
40-
diagram.Links.Should().BeEmpty();
39+
Assert.Empty(diagram.Links);
4140
}
4241

4342
[Fact]
@@ -52,8 +51,8 @@ public void Remove_ShouldRemoveItselfFromParentGroup()
5251
diagram.Nodes.Remove(node);
5352

5453
// Assert
55-
group.Children.Should().BeEmpty();
56-
node.Group.Should().BeNull();
54+
Assert.Empty(group.Children);
55+
Assert.Null(node.Group);
5756
}
5857

5958
[Fact]
@@ -68,7 +67,7 @@ public void Add_ShouldRefreshDiagramOnce()
6867
var node = diagram.Nodes.Add(new NodeModel());
6968

7069
// Assert
71-
refreshes.Should().Be(1);
70+
Assert.Equal(1,refreshes);
7271
}
7372

7473
[Fact]
@@ -86,7 +85,7 @@ public void Remove_ShouldRefreshDiagramOnce()
8685
diagram.Nodes.Remove(node1);
8786

8887
// Assert
89-
refreshes.Should().Be(1);
88+
Assert.Equal(1,refreshes);
9089
}
9190

9291
[Fact]
@@ -101,6 +100,6 @@ public void Remove_ShouldRemoveControls()
101100
diagram.Nodes.Remove(node);
102101

103102
// Assert
104-
diagram.Controls.GetFor(node).Should().BeNull();
103+
Assert.Null(diagram.Controls.GetFor(node));
105104
}
106105
}

tests/Blazor.Diagrams.Core.Tests/Models/Base/BaseLinkModelTests.cs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using Blazor.Diagrams.Core.Models.Base;
55
using Blazor.Diagrams.Core.PathGenerators;
66
using Blazor.Diagrams.Core.Routers;
7-
using FluentAssertions;
87
using Xunit;
98

109
namespace Blazor.Diagrams.Core.Tests.Models.Base;
@@ -36,12 +35,12 @@ public void SetSource_ShouldChangePropertiesAndTriggerEvent()
3635
link.SetSource(sp);
3736

3837
// Assert
39-
eventsTriggered.Should().Be(1);
40-
link.Source.Should().BeSameAs(sp);
41-
oldSp.Should().NotBeNull();
42-
newSp.Should().BeSameAs(sp);
43-
linkInstance.Should().BeSameAs(link);
44-
link.Source.Model.Should().BeSameAs(port);
38+
Assert.Equal(1,eventsTriggered);
39+
Assert.Same(sp,link.Source);
40+
Assert.NotNull(oldSp);
41+
Assert.Same(sp,newSp);
42+
Assert.Same(link,linkInstance);
43+
Assert.Same(port,link.Source.Model);
4544
}
4645

4746
[Fact]
@@ -69,12 +68,12 @@ public void SetTarget_ShouldChangePropertiesAndTriggerEvent()
6968
link.SetTarget(tp);
7069

7170
// Assert
72-
eventsTriggered.Should().Be(1);
73-
link.Target.Should().BeSameAs(tp);
74-
oldTp.Should().BeOfType<PositionAnchor>();
75-
newTp.Should().BeSameAs(tp);
76-
linkInstance.Should().BeSameAs(link);
77-
link.Target!.Model.Should().BeSameAs(port);
71+
Assert.Equal(1,eventsTriggered);
72+
Assert.Same(tp,link.Target);
73+
Assert.IsType<PositionAnchor>(oldTp);
74+
Assert.Same(tp,newTp);
75+
Assert.Same(link,linkInstance);
76+
Assert.Same(port,link.Target!.Model);
7877
}
7978

8079
[Fact]
@@ -91,9 +90,9 @@ public void GetBounds_ShouldReturnPathBBox()
9190
var bounds = link.GetBounds()!;
9291

9392
// Assert
94-
bounds.Left.Should().Be(10);
95-
bounds.Top.Should().Be(5);
96-
bounds.Width.Should().Be(90);
97-
bounds.Height.Should().Be(75);
93+
Assert.Equal(10,bounds.Left);
94+
Assert.Equal(5,bounds.Top);
95+
Assert.Equal(90,bounds.Width);
96+
Assert.Equal(75,bounds.Height);
9897
}
9998
}

tests/Blazor.Diagrams.Core.Tests/Positions/Resizing/BottomRightResizerProviderTests.cs

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using Blazor.Diagrams.Core.Geometry;
55
using Blazor.Diagrams.Core.Models;
66
using Blazor.Diagrams.Core.Positions.Resizing;
7-
using FluentAssertions;
87
using Xunit;
98

109
namespace Blazor.Diagrams.Core.Tests.Positions.Resizing;
@@ -24,10 +23,10 @@ public void DragResizer_ShouldResizeNode()
2423
diagram.SelectModel(node, false);
2524

2625
// before resize
27-
node.Position.X.Should().Be(0);
28-
node.Position.Y.Should().Be(0);
29-
node.Size.Width.Should().Be(100);
30-
node.Size.Height.Should().Be(200);
26+
Assert.Equal(0,node.Position.X);
27+
Assert.Equal(0,node.Position.Y);
28+
Assert.Equal(100,node.Size.Width);
29+
Assert.Equal(200,node.Size.Height);
3130

3231
// resize
3332
var eventArgs = new PointerEventArgs(0, 0, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
@@ -36,10 +35,10 @@ public void DragResizer_ShouldResizeNode()
3635
diagram.TriggerPointerMove(null, eventArgs);
3736

3837
// after resize
39-
node.Position.X.Should().Be(0);
40-
node.Position.Y.Should().Be(0);
41-
node.Size.Width.Should().Be(110);
42-
node.Size.Height.Should().Be(215);
38+
Assert.Equal(0,node.Position.X);
39+
Assert.Equal(0,node.Position.Y);
40+
Assert.Equal(110,node.Size.Width);
41+
Assert.Equal(215,node.Size.Height);
4342
}
4443

4544
[Fact]
@@ -57,10 +56,10 @@ public void PanChanged_ShouldResizeNode()
5756

5857

5958
// before resize
60-
node.Position.X.Should().Be(0);
61-
node.Position.Y.Should().Be(0);
62-
node.Size.Width.Should().Be(100);
63-
node.Size.Height.Should().Be(200);
59+
Assert.Equal(0,node.Position.X);
60+
Assert.Equal(0,node.Position.Y);
61+
Assert.Equal(100,node.Size.Width);
62+
Assert.Equal(200,node.Size.Height);
6463

6564
// resize
6665
var eventArgs = new PointerEventArgs(0, 0, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
@@ -69,10 +68,10 @@ public void PanChanged_ShouldResizeNode()
6968

7069

7170
// after resize
72-
node.Position.X.Should().Be(0);
73-
node.Position.Y.Should().Be(0);
74-
node.Size.Width.Should().Be(110);
75-
node.Size.Height.Should().Be(300);
71+
Assert.Equal(0,node.Position.X);
72+
Assert.Equal(0,node.Position.Y);
73+
Assert.Equal(110,node.Size.Width);
74+
Assert.Equal(300,node.Size.Height);
7675
}
7776

7877
[Fact]
@@ -88,10 +87,10 @@ public void DragResizer_SmallerThanMinSize_SetsNodeToMinSize()
8887
diagram.SelectModel(node, false);
8988

9089
// before resize
91-
node.Position.X.Should().Be(0);
92-
node.Position.Y.Should().Be(0);
93-
node.Size.Width.Should().Be(100);
94-
node.Size.Height.Should().Be(200);
90+
Assert.Equal(0,node.Position.X);
91+
Assert.Equal(0,node.Position.Y);
92+
Assert.Equal(100,node.Size.Width);
93+
Assert.Equal(200,node.Size.Height);
9594

9695
// resize
9796
var eventArgs = new PointerEventArgs(0, 0, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
@@ -100,10 +99,10 @@ public void DragResizer_SmallerThanMinSize_SetsNodeToMinSize()
10099
diagram.TriggerPointerMove(null, eventArgs);
101100

102101
// after resize
103-
node.Position.X.Should().Be(0);
104-
node.Position.Y.Should().Be(0);
105-
node.Size.Width.Should().Be(0);
106-
node.Size.Height.Should().Be(0);
102+
Assert.Equal(0,node.Position.X);
103+
Assert.Equal(0,node.Position.Y);
104+
Assert.Equal(0,node.Size.Width);
105+
Assert.Equal(0,node.Size.Height);
107106
}
108107

109108
[Fact]
@@ -120,10 +119,10 @@ public void DragResizer_ShouldResizeNode_WhenDiagramZoomedOut()
120119
diagram.SetZoom(0.5);
121120

122121
// before resize
123-
node.Position.X.Should().Be(0);
124-
node.Position.Y.Should().Be(0);
125-
node.Size.Width.Should().Be(100);
126-
node.Size.Height.Should().Be(200);
122+
Assert.Equal(0,node.Position.X);
123+
Assert.Equal(0,node.Position.Y);
124+
Assert.Equal(100,node.Size.Width);
125+
Assert.Equal(200,node.Size.Height);
127126

128127
// resize
129128
var eventArgs = new PointerEventArgs(0, 0, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
@@ -132,10 +131,10 @@ public void DragResizer_ShouldResizeNode_WhenDiagramZoomedOut()
132131
diagram.TriggerPointerMove(null, eventArgs);
133132

134133
// after resize
135-
node.Position.X.Should().Be(0);
136-
node.Position.Y.Should().Be(0);
137-
node.Size.Width.Should().Be(120);
138-
node.Size.Height.Should().Be(230);
134+
Assert.Equal(0,node.Position.X);
135+
Assert.Equal(0,node.Position.Y);
136+
Assert.Equal(120,node.Size.Width);
137+
Assert.Equal(230,node.Size.Height);
139138
}
140139

141140
[Fact]
@@ -152,10 +151,10 @@ public void DragResizer_ShouldResizeNode_WhenDiagramZoomedIn()
152151
diagram.SetZoom(2);
153152

154153
// before resize
155-
node.Position.X.Should().Be(0);
156-
node.Position.Y.Should().Be(0);
157-
node.Size.Width.Should().Be(100);
158-
node.Size.Height.Should().Be(200);
154+
Assert.Equal(0,node.Position.X);
155+
Assert.Equal(0,node.Position.Y);
156+
Assert.Equal(100,node.Size.Width);
157+
Assert.Equal(200,node.Size.Height);
159158

160159
// resize
161160
var eventArgs = new PointerEventArgs(0, 0, 0, 0, false, false, false, 1, 1, 1, 1, 1, 1, "arrow", true);
@@ -164,9 +163,9 @@ public void DragResizer_ShouldResizeNode_WhenDiagramZoomedIn()
164163
diagram.TriggerPointerMove(null, eventArgs);
165164

166165
// after resize
167-
node.Position.X.Should().Be(0);
168-
node.Position.Y.Should().Be(0);
169-
node.Size.Width.Should().Be(105);
170-
node.Size.Height.Should().Be(207.5);
166+
Assert.Equal(0,node.Position.X);
167+
Assert.Equal(0,node.Position.Y);
168+
Assert.Equal(105,node.Size.Width);
169+
Assert.Equal(207.5,node.Size.Height);
171170
}
172171
}

0 commit comments

Comments
 (0)