diff --git a/DotsTests/NoticesRepositoryTests.cs b/DotsTests/NoticesRepositoryTests.cs index 7a1f91a..1856811 100644 --- a/DotsTests/NoticesRepositoryTests.cs +++ b/DotsTests/NoticesRepositoryTests.cs @@ -53,7 +53,7 @@ public async Task TestGetNotices() IEnumerable notices = await _noticesRepository.GetNoticesAsync("60848ae8fb71edf2a7ebf846"); Assert.NotNull(notices); - Assert.AreEqual(notices.Count(), 1); + Assert.AreEqual(1, notices.Count()); } catch (Exception ex) { @@ -82,7 +82,7 @@ public async Task TestAddNotice() IEnumerable notices = await _noticesRepository.GetNoticesAsync("60848ae8fb71edf2a7ebf846"); - Assert.AreEqual(notices.Count(), 2); + Assert.AreEqual(2, notices.Count()); } catch (Exception ex) { @@ -113,7 +113,7 @@ public async Task TestUpdateNotice() notice.Name = "Name Changed"; await _noticesRepository.UpdateNoticeAsync(notice); notice = getNotice(UserId, NoticeId); - Assert.AreEqual(notice.Name, "Name Changed"); + Assert.AreEqual("Name Changed", notice.Name); DateTime oldTime = notice.TimeCompleted; notice.TimeCompleted = notice.TimeCompleted.AddMinutes(30); @@ -125,8 +125,8 @@ public async Task TestUpdateNotice() notice.TimeCompleted = oldTime; await _noticesRepository.UpdateNoticeAsync(notice); notice = getNotice(UserId, NoticeId); - Assert.AreEqual(notice.Name, "changed again"); - Assert.AreEqual(notice.TimeCompleted, oldTime); + Assert.AreEqual("changed again", notice.Name); + Assert.AreEqual(oldTime, notice.TimeCompleted); } catch (Exception ex) { @@ -145,7 +145,7 @@ public async Task TestDeleteNotice() try { User user = await _usersCollection.Find(u => u.Id == "60848ae8fb71edf2a7ebf846").FirstOrDefaultAsync(); - Assert.AreEqual(user.Notices.Count(), 1); + Assert.AreEqual(1, user.Notices.Count()); await _noticesRepository.DeleteNoticeAsync(user.Id, "608235aea059ac5c9af6da20"); user = await _usersCollection.Find(u => u.Id == "60848ae8fb71edf2a7ebf846").FirstOrDefaultAsync(); diff --git a/DotsTests/UsersControllerTests.cs b/DotsTests/UsersControllerTests.cs index 77f4d63..764b802 100644 --- a/DotsTests/UsersControllerTests.cs +++ b/DotsTests/UsersControllerTests.cs @@ -104,8 +104,8 @@ public async Task TestAuthenticate() OkObjectResult result = await _usersController.AuthenticateAsync(dto) as OkObjectResult; BsonDocument elements = result.Value.ToBsonDocument(); - Assert.AreEqual(elements.GetValue("_id").ToString(), "60848ae8fb71edf2a7ebf846"); - Assert.AreEqual(elements.GetValue("Email").ToString(), dto.Email); + Assert.AreEqual("60848ae8fb71edf2a7ebf846", elements.GetValue("_id").ToString()); + Assert.AreEqual(dto.Email, elements.GetValue("Email").ToString()); Assert.NotNull(elements.GetValue("Token")); dto.Email = "nonExistentEmail"; diff --git a/DotsTests/UsersRepositoryTests.cs b/DotsTests/UsersRepositoryTests.cs index 8057527..bb5d5e5 100644 --- a/DotsTests/UsersRepositoryTests.cs +++ b/DotsTests/UsersRepositoryTests.cs @@ -35,7 +35,7 @@ public async Task TestGetUserById() User user = await _usersRepository.GetUserByIdAsync("60848ae8fb71edf2a7ebf846"); Assert.IsNotNull(user); - Assert.AreEqual(user.Email, "test@subject.zero"); + Assert.AreEqual("test@subject.zero", user.Email); } [Test] @@ -44,7 +44,7 @@ public async Task TestGetUserByEmail() User user = await _usersRepository.GetUserByEmailAsync("test@subject.zero"); Assert.IsNotNull(user); - Assert.AreEqual(user.Id, "60848ae8fb71edf2a7ebf846"); + Assert.AreEqual("60848ae8fb71edf2a7ebf846", user.Id); } [Test] @@ -98,8 +98,8 @@ public async Task TestAuthenticate() User result = await _usersRepository.AuthenticateAsync(email, password); Assert.IsNotNull(result); - Assert.AreEqual(result.Id, "60848ae8fb71edf2a7ebf846"); - Assert.AreEqual(result.Email, email); + Assert.AreEqual("60848ae8fb71edf2a7ebf846", result.Id); + Assert.AreEqual(email, result.Email); Assert.True(BCrypt.Net.BCrypt.Verify(password, result.PasswordHash)); } catch (Exception ex) @@ -138,7 +138,7 @@ public async Task TestUpdateUser() await _usersRepository.UpdateUserAsync(replacement); User updatedUser = await _usersCollection.Find(u => u.Email == "newEmail").FirstOrDefaultAsync(); Assert.NotNull(updatedUser); - Assert.AreEqual(updatedUser.Id, replacement.Id); + Assert.AreEqual(replacement.Id, updatedUser.Id); await _usersRepository.UpdateUserAsync(updatedUser, "newPassword"); updatedUser = await _usersCollection.Find(u => u.Id == "60848ae8fb71edf2a7ebf846").FirstOrDefaultAsync(); @@ -148,7 +148,7 @@ public async Task TestUpdateUser() await _usersRepository.UpdateUserAsync(replacement, "oldPassword"); updatedUser = await _usersCollection.Find(u => u.Id == "60848ae8fb71edf2a7ebf846").FirstOrDefaultAsync(); - Assert.AreEqual(updatedUser.Email, "test@subject.zero"); + Assert.AreEqual("test@subject.zero", updatedUser.Email); Assert.True(BCrypt.Net.BCrypt.Verify("oldPassword", updatedUser.PasswordHash)); } catch (Exception ex)