From 6b11b2001a227a09387548853071c63b6fe5c991 Mon Sep 17 00:00:00 2001 From: Danail Dimitrov Date: Thu, 28 Jan 2021 21:25:56 +0200 Subject: Refactored tests after the boys broke them --- .../DevHive.Data.Tests/UserRepositoryTests.cs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/DevHive.Tests/DevHive.Data.Tests/UserRepositoryTests.cs') diff --git a/src/DevHive.Tests/DevHive.Data.Tests/UserRepositoryTests.cs b/src/DevHive.Tests/DevHive.Data.Tests/UserRepositoryTests.cs index 6cc7b87..0d262f5 100644 --- a/src/DevHive.Tests/DevHive.Data.Tests/UserRepositoryTests.cs +++ b/src/DevHive.Tests/DevHive.Data.Tests/UserRepositoryTests.cs @@ -60,6 +60,22 @@ namespace DevHive.Data.Tests } #endregion + #region EditAsync + [Test] + public async Task EditAsync_ReturnsTrue_WhenUserIsUpdatedSuccessfully() + { + User oldUser = this.CreateDummyUser(); + this._context.Users.Add(oldUser); + await this._context.SaveChangesAsync(); + + oldUser.UserName = "SuperSecretUserName"; + bool result = await this._userRepository.EditAsync(oldUser.Id, oldUser); + + Assert.IsTrue(result, "EditAsync does not return true when User is updated successfully"); + Assert.Fail("Docurshi drugite"); + } + #endregion + #region GetByIdAsync [Test] public async Task GetByIdAsync_ReturnsTheUse_WhenItExists() @@ -188,8 +204,10 @@ namespace DevHive.Data.Tests { User dummyUser = this.CreateDummyUser(); User anotherDummyUser = this.CreateAnotherDummyUser(); - HashSet friends = new HashSet(); - friends.Add(anotherDummyUser); + HashSet friends = new HashSet + { + anotherDummyUser + }; dummyUser.Friends = friends; this._context.Users.Add(dummyUser); -- cgit v1.2.3