Skip to content

Commit a612d8e

Browse files
committed
FluentAssertion removed from chunk2 files
1 parent bc2460f commit a612d8e

File tree

8 files changed

+132
-140
lines changed

8 files changed

+132
-140
lines changed

tests/Blazor.Diagrams.Core.Tests/Behaviors/DragNewLinkBehaviorTests.cs

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using Blazor.Diagrams.Core.Events;
44
using Blazor.Diagrams.Core.Geometry;
55
using Blazor.Diagrams.Core.Models;
6-
using FluentAssertions;
76
using System.Linq;
87
using Xunit;
98

@@ -32,11 +31,11 @@ public void Behavior_ShouldCreateLinkWithSinglePortAnchorSource_WhenMouseDownOnP
3231
// Assert
3332
var link = diagram.Links.Single();
3433
var source = link.Source as SinglePortAnchor;
35-
source.Should().NotBeNull();
36-
source!.Port.Should().BeSameAs(port);
34+
Assert.NotNull(source);
35+
Assert.Same(port, source!.Port);
3736
var ongoingPosition = (link.Target as PositionAnchor)!.GetPlainPosition()!;
38-
ongoingPosition.X.Should().Be(100);
39-
ongoingPosition.Y.Should().Be(100);
37+
Assert.Equal(100, ongoingPosition.X);
38+
Assert.Equal(100,ongoingPosition.Y);
4039
}
4140

4241
[Fact]
@@ -64,14 +63,14 @@ public void Behavior_ShouldCreateLinkUsingFactory_WhenMouseDownOnPort()
6463
new PointerEventArgs(100, 100, 0, 0, false, false, false, 0, 0, 0, 0, 0, 0, string.Empty, true));
6564

6665
// Assert
67-
factoryCalled.Should().BeTrue();
66+
Assert.True(factoryCalled);
6867
var link = diagram.Links.Single();
6968
var source = link.Source as SinglePortAnchor;
70-
source.Should().NotBeNull();
71-
source!.Port.Should().BeSameAs(port);
69+
Assert.NotNull(source);
70+
Assert.Same(port, source!.Port);
7271
var ongoingPosition = (link.Target as PositionAnchor)!.GetPlainPosition()!;
73-
ongoingPosition.X.Should().Be(100);
74-
ongoingPosition.Y.Should().Be(100);
72+
Assert.Equal(100, ongoingPosition.X);
73+
Assert.Equal(100,ongoingPosition.Y);
7574
}
7675

7776
[Fact]
@@ -100,9 +99,9 @@ public void Behavior_ShouldUpdateOngoingPosition_WhenMouseMoveIsTriggered()
10099
// Assert
101100
var source = link.Source as SinglePortAnchor;
102101
var ongoingPosition = (link.Target as PositionAnchor)!.GetPlainPosition()!;
103-
ongoingPosition.X.Should().BeGreaterThan(145);
104-
ongoingPosition.Y.Should().BeGreaterThan(145);
105-
linkRefreshed.Should().BeTrue();
102+
Assert.True(ongoingPosition.X > 145);
103+
Assert.True(ongoingPosition.Y > 145);
104+
Assert.True(linkRefreshed);
106105
}
107106

108107
[Fact]
@@ -132,9 +131,9 @@ public void Behavior_ShouldUpdateOngoingPosition_WhenMouseMoveIsTriggeredAndZoom
132131
// Assert
133132
var source = link.Source as SinglePortAnchor;
134133
var ongoingPosition = (link.Target as PositionAnchor)!.GetPlainPosition()!;
135-
ongoingPosition.X.Should().BeApproximately(107.7, 0.1);
136-
ongoingPosition.Y.Should().BeApproximately(101.7, 0.1);
137-
linkRefreshed.Should().BeTrue();
134+
Assert.InRange(ongoingPosition.X, 107.6, 108.8);
135+
Assert.InRange(ongoingPosition.Y, 101.6, 101.8);
136+
Assert.True(linkRefreshed);
138137
}
139138

140139
[Fact]
@@ -172,9 +171,9 @@ public void Behavior_ShouldSnapToClosestPortAndRefreshPort_WhenSnappingIsEnabled
172171
// Assert
173172
var link = diagram.Links.Single();
174173
var target = link.Target as SinglePortAnchor;
175-
target.Should().NotBeNull();
176-
target!.Port.Should().BeSameAs(port2);
177-
port2Refreshed.Should().BeTrue();
174+
Assert.NotNull(target);
175+
Assert.Same(port2, target!.Port);
176+
Assert.True(port2Refreshed);
178177
}
179178

180179
[Fact]
@@ -209,7 +208,7 @@ public void Behavior_ShouldNotSnapToPort_WhenSnappingIsEnabledAndPortIsNotInRadi
209208

210209
// Assert
211210
var link = diagram.Links.Single();
212-
link.Target.Should().BeOfType<PositionAnchor>();
211+
Assert.IsType<PositionAnchor>(link.Target);
213212
}
214213

215214
[Fact]
@@ -251,8 +250,8 @@ public void Behavior_ShouldUnSnapAndRefreshPort_WhenSnappingIsEnabledAndPortIsNo
251250
// Assert
252251
var link = diagram.Links.Single();
253252
var target = link.Target as SinglePortAnchor;
254-
target.Should().BeNull();
255-
port2Refreshes.Should().Be(2);
253+
Assert.Null(target);
254+
Assert.Equal(2,port2Refreshes);
256255
}
257256

258257
[Fact]
@@ -276,7 +275,7 @@ public void Behavior_ShouldRemoveLink_WhenMouseUpOnCanvasAndRequireTargetIsTrue(
276275
new PointerEventArgs(0, 0, 0, 0, false, false, false, 0, 0, 0, 0, 0, 0, string.Empty, true));
277276

278277
// Assert
279-
diagram.Links.Should().BeEmpty();
278+
Assert.Empty(diagram.Links);
280279
}
281280

282281
[Fact]
@@ -300,7 +299,7 @@ public void Behavior_ShouldRemoveLink_WhenMouseUpOnSamePort()
300299
new PointerEventArgs(0, 0, 0, 0, false, false, false, 0, 0, 0, 0, 0, 0, string.Empty, true));
301300

302301
// Assert
303-
diagram.Links.Should().BeEmpty();
302+
Assert.Empty(diagram.Links);
304303
}
305304

306305
[Fact]
@@ -336,9 +335,9 @@ public void Behavior_ShouldSetTarget_WhenMouseUp()
336335
// Assert
337336
var link = diagram.Links.Single();
338337
var target = link.Target as SinglePortAnchor;
339-
target.Should().NotBeNull();
340-
target!.Port.Should().BeSameAs(port2);
341-
port2Refreshes.Should().Be(1);
338+
Assert.NotNull(target);
339+
Assert.Same(port2, target!.Port);
340+
Assert.Equal(1, port2Refreshes);
342341
}
343342

344343
[Fact]
@@ -363,7 +362,7 @@ public void Behavior_ShouldNotCreateOngoingLink_WhenFactoryReturnsNull()
363362
new PointerEventArgs(100, 100, 0, 0, false, false, false, 0, 0, 0, 0, 0, 0, string.Empty, true));
364363

365364
// Assert
366-
diagram.Links.Should().HaveCount(0);
365+
Assert.Empty(diagram.Links);
367366
}
368367

369368
[Fact]
@@ -399,7 +398,7 @@ public void Behavior_ShouldTriggerLinkTargetAttached_WhenMouseUpOnOtherPort()
399398
new PointerEventArgs(105, 105, 0, 0, false, false, false, 0, 0, 0, 0, 0, 0, string.Empty, true));
400399

401400
// Assert
402-
targetAttachedTriggers.Should().Be(1);
401+
Assert.Equal(1,targetAttachedTriggers);
403402
}
404403

405404
[Fact]
@@ -440,7 +439,7 @@ public void Behavior_ShouldTriggerLinkTargetAttached_WhenLinkSnappedToPortAndMou
440439
new PointerEventArgs(140, 100, 0, 0, false, false, false, 0, 0, 0, 0, 0, 0, string.Empty, true));
441440

442441
// Assert
443-
targetAttachedTriggers.Should().Be(1);
442+
Assert.Equal(1, targetAttachedTriggers);
444443
}
445444

446445
[Fact]
@@ -463,7 +462,7 @@ public void Behavior_ShouldNotCreateLinkWithSinglePortAnchorSource_WhenMouseDown
463462
new PointerEventArgs(100, 100, 0, 0, false, false, false, 0, 0, 0, 0, 0, 0, string.Empty, true));
464463

465464
// Assert
466-
diagram.Links.Count.Should().Be(0);
465+
Assert.Equal(0, diagram.Links.Count);
467466
}
468467

469468
[Fact]
@@ -494,8 +493,8 @@ public void Behavior_ShouldUpdateOngoingPosition_WhenPanChanges()
494493
// Assert
495494
var source = link.Source as SinglePortAnchor;
496495
var ongoingPosition = (link.Target as PositionAnchor)!.GetPlainPosition()!;
497-
ongoingPosition.X.Should().BeApproximately(expectedValue: 246, 1);
498-
ongoingPosition.Y.Should().BeApproximately(expectedValue: 246, 1);
499-
linkRefreshed.Should().BeTrue();
496+
Assert.InRange(ongoingPosition.X, 245, 247);
497+
Assert.InRange(ongoingPosition.Y, 245, 247);
498+
Assert.True(linkRefreshed);
500499
}
501500
}

tests/Blazor.Diagrams.Core.Tests/Behaviors/EventsBehaviorTests.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using Blazor.Diagrams.Core.Behaviors;
22
using Blazor.Diagrams.Core.Events;
3-
using FluentAssertions;
43
using System.Threading.Tasks;
54
using Xunit;
65

@@ -22,7 +21,7 @@ public void Behavior_ShouldNotTriggerMouseClick_WhenItsRemoved()
2221
diagram.TriggerPointerUp(null, new PointerEventArgs(0, 0, 0, 0, false, false, false, 0, 0, 0, 0, 0, 0, string.Empty, true));
2322

2423
// Assert
25-
eventTriggered.Should().BeFalse();
24+
Assert.False(eventTriggered);
2625
}
2726

2827
[Fact]
@@ -38,7 +37,7 @@ public void Behavior_ShouldTriggerMouseClick_WhenMouseDownThenUpWithoutMove()
3837
diagram.TriggerPointerUp(null, new PointerEventArgs(0, 0, 0, 0, false, false, false, 0, 0, 0, 0, 0, 0, string.Empty, true));
3938

4039
// Assert
41-
eventTriggered.Should().BeTrue();
40+
Assert.True(eventTriggered);
4241
}
4342

4443
[Fact]
@@ -55,7 +54,7 @@ public void Behavior_ShouldNotTriggerMouseClick_WhenMouseMoves()
5554
diagram.TriggerPointerUp(null, new PointerEventArgs(0, 0, 0, 0, false, false, false, 0, 0, 0, 0, 0, 0, string.Empty, true));
5655

5756
// Assert
58-
eventTriggered.Should().BeFalse();
57+
Assert.False(eventTriggered);
5958
}
6059

6160
[Fact]
@@ -71,7 +70,7 @@ public void Behavior_ShouldTriggerMouseDoubleClick_WhenTwoMouseClicksHappenWithi
7170
diagram.TriggerPointerClick(null, new PointerEventArgs(0, 0, 0, 0, false, false, false, 0, 0, 0, 0, 0, 0, string.Empty, true));
7271

7372
// Assert
74-
eventTriggered.Should().BeTrue();
73+
Assert.True(eventTriggered);
7574
}
7675

7776
[Fact]
@@ -88,7 +87,7 @@ public async Task Behavior_ShouldNotTriggerMouseDoubleClick_WhenTimeExceeds500()
8887
diagram.TriggerPointerClick(null, new PointerEventArgs(0, 0, 0, 0, false, false, false, 0, 0, 0, 0, 0, 0, string.Empty, true));
8988

9089
// Assert
91-
eventTriggered.Should().BeFalse();
90+
Assert.False(eventTriggered);
9291
}
9392

9493
[Fact]
@@ -103,6 +102,6 @@ public void Behavior_ShouldTriggerMouseClick_OnlyWhenMouseDownWasAlsoTriggered_I
103102
diagram.TriggerPointerUp(null, new PointerEventArgs(0, 0, 0, 0, false, false, false, 0, 0, 0, 0, 0, 0, string.Empty, true));
104103

105104
// Assert
106-
eventTriggered.Should().BeFalse();
105+
Assert.False(eventTriggered);
107106
}
108107
}

tests/Blazor.Diagrams.Core.Tests/Behaviors/KeyboardShortcutsBehaviorTests.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using Blazor.Diagrams.Core.Behaviors;
22
using Blazor.Diagrams.Core.Events;
3-
using FluentAssertions;
43
using System.Threading.Tasks;
54
using Xunit;
65

@@ -33,7 +32,7 @@ public void Behavior_ShouldExecuteAction_WhenCombinationIsPressed(string key, bo
3332
diagram.TriggerKeyDown(new KeyboardEventArgs(key, key, 0, ctrl, shift, alt));
3433

3534
// Assert
36-
executed.Should().BeTrue();
35+
Assert.True(executed);
3736
}
3837

3938
[Fact]
@@ -55,7 +54,7 @@ public void Behavior_ShouldDoNothing_WhenRemoved()
5554
diagram.TriggerKeyDown(new KeyboardEventArgs("A", "A", 0, false, false, false));
5655

5756
// Assert
58-
executed.Should().BeFalse();
57+
Assert.False(executed);
5958
}
6059

6160
[Fact]
@@ -83,7 +82,7 @@ public void SetShortcut_ShouldOverride()
8382
diagram.TriggerKeyDown(new KeyboardEventArgs("A", "A", 0, false, false, false));
8483

8584
// Assert
86-
executed1.Should().BeFalse();
87-
executed2.Should().BeTrue();
85+
Assert.False(executed1);
86+
Assert.True(executed2);
8887
}
8988
}

tests/Blazor.Diagrams.Core.Tests/Behaviors/KeyboardShortcutsDefaultsTests.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using Blazor.Diagrams.Core.Behaviors;
22
using Blazor.Diagrams.Core.Models;
3-
using FluentAssertions;
43
using System;
54
using System.Threading.Tasks;
65
using Xunit;
@@ -24,7 +23,7 @@ public async Task DeleteSelection_ShouldNotDeleteModel_WhenItsLocked()
2423
await KeyboardShortcutsDefaults.DeleteSelection(diagram);
2524

2625
// Assert
27-
diagram.Nodes.Count.Should().Be(1);
26+
Assert.Equal(1, diagram.Nodes.Count);
2827
}
2928

3029
[Fact]
@@ -47,8 +46,8 @@ public async Task DeleteSelection_ShouldTakeIntoAccountGroupConstraint()
4746
await KeyboardShortcutsDefaults.DeleteSelection(diagram);
4847

4948
// Assert
50-
funcCalled.Should().BeTrue();
51-
diagram.Groups.Count.Should().Be(1);
49+
Assert.True(funcCalled);
50+
Assert.Equal(1, diagram.Groups.Count);
5251
}
5352

5453
[Fact]
@@ -71,8 +70,8 @@ public async Task DeleteSelection_ShouldTakeIntoAccountNodeConstraint()
7170
await KeyboardShortcutsDefaults.DeleteSelection(diagram);
7271

7372
// Assert
74-
funcCalled.Should().BeTrue();
75-
diagram.Nodes.Count.Should().Be(1);
73+
Assert.True(funcCalled);
74+
Assert.Equal(1, diagram.Nodes.Count);
7675
}
7776

7877
[Fact]
@@ -100,8 +99,8 @@ public async Task DeleteSelection_ShouldTakeIntoAccountLinkConstraint()
10099
await KeyboardShortcutsDefaults.DeleteSelection(diagram);
101100

102101
// Assert
103-
funcCalled.Should().BeTrue();
104-
diagram.Links.Count.Should().Be(1);
102+
Assert.True(funcCalled);
103+
Assert.Equal(1, diagram.Links.Count);
105104
}
106105

107106
[Fact]
@@ -126,8 +125,8 @@ public async Task DeleteSelection_ShouldResultInSingleRefresh()
126125
await KeyboardShortcutsDefaults.DeleteSelection(diagram);
127126

128127
// Assert
129-
diagram.Nodes.Count.Should().Be(0);
130-
diagram.Links.Count.Should().Be(0);
131-
refreshes.Should().Be(1);
128+
Assert.Equal(0, diagram.Nodes.Count);
129+
Assert.Equal(0, diagram.Links.Count);
130+
Assert.Equal(1, refreshes);
132131
}
133132
}

0 commit comments

Comments
 (0)