From 8c07138160ea4a49187e6beceb602bc36a74d662 Mon Sep 17 00:00:00 2001 From: iFew Date: Fri, 1 Mar 2019 10:28:46 +0700 Subject: [PATCH] Changed assert Equal to using Empty and Single to good practice and skip warning when testing --- .../WebSocketConnectionManagerTests.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/WebSocketManager.Tests/WebSocketConnectionManagerTests.cs b/test/WebSocketManager.Tests/WebSocketConnectionManagerTests.cs index 66c775b..eae64dd 100644 --- a/test/WebSocketManager.Tests/WebSocketConnectionManagerTests.cs +++ b/test/WebSocketManager.Tests/WebSocketConnectionManagerTests.cs @@ -43,7 +43,7 @@ public class GetAll : WebSocketConnectionManagerTests [Fact] public void WhenEmpty_ShouldReturnZero() { - Assert.Equal(0, _manager.GetAll().Count); + Assert.Empty(_manager.GetAll()); } [Fact] @@ -51,7 +51,7 @@ public void WhenOneSocket_ShouldReturnOne() { _manager.AddSocket(new FakeSocket()); - Assert.Equal(1, _manager.GetAll().Count); + Assert.Single(_manager.GetAll()); } } @@ -73,7 +73,7 @@ public void WhenOneSocketInGroup_ShouldReturnOne() var socketID = _manager.GetId(socket); _manager.AddToGroup(socketID, GroupName); - Assert.Equal(1, _manager.GetAllFromGroup(GroupName).Count); + Assert.Single(_manager.GetAllFromGroup(GroupName)); } } @@ -114,7 +114,7 @@ public void WhenNull_ShouldNotNotContainSocket() { _manager.AddSocket(null); - Assert.Equal(0, _manager.GetAll().Count); + Assert.Empty(_manager.GetAll()); } [Fact] @@ -122,7 +122,7 @@ public void WhenInstance_ShouldContainSocket() { _manager.AddSocket(new FakeSocket()); - Assert.Equal(1, _manager.GetAll().Count); + Assert.Single(_manager.GetAll()); } } @@ -149,4 +149,4 @@ public void WhenRemoveNonExisting_ShouldNotThrowException() } } } -} \ No newline at end of file +}