aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Services/DevHive.Services.Tests/CommentService.Tests.cs6
-rw-r--r--src/Services/DevHive.Services.Tests/LanguageService.Tests.cs8
-rw-r--r--src/Services/DevHive.Services.Tests/PostService.Tests.cs16
-rw-r--r--src/Services/DevHive.Services.Tests/RoleService.Tests.cs8
-rw-r--r--src/Services/DevHive.Services.Tests/TechnologyServices.Tests.cs8
-rw-r--r--src/Services/DevHive.Services.Tests/UserService.Tests.cs2
6 files changed, 24 insertions, 24 deletions
diff --git a/src/Services/DevHive.Services.Tests/CommentService.Tests.cs b/src/Services/DevHive.Services.Tests/CommentService.Tests.cs
index d843375..2d3c97a 100644
--- a/src/Services/DevHive.Services.Tests/CommentService.Tests.cs
+++ b/src/Services/DevHive.Services.Tests/CommentService.Tests.cs
@@ -120,7 +120,7 @@ namespace DevHive.Services.Tests
_ = this.UserRepositoryMock.Setup(p => p.GetByIdAsync(It.IsAny<Guid>())).Returns(Task.FromResult(user));
_ = this.MapperMock.Setup(p => p.Map<ReadCommentServiceModel>(It.IsAny<Comment>())).Returns(commentServiceModel);
- ReadCommentServiceModel result = await this.CommentService.GetCommentById(new Guid());
+ ReadCommentServiceModel result = await this.CommentService.GetCommentById(Guid.NewGuid());
Assert.AreEqual(MESSAGE, result.Message);
}
@@ -139,7 +139,7 @@ namespace DevHive.Services.Tests
_ = this.CommentRepositoryMock.Setup(p => p.GetByIdAsync(It.IsAny<Guid>())).Returns(Task.FromResult(comment));
- Exception ex = Assert.ThrowsAsync<ArgumentException>(() => this.CommentService.GetCommentById(new Guid()), "GetCommentById does not throw exception when the user does not exist");
+ Exception ex = Assert.ThrowsAsync<ArgumentException>(() => this.CommentService.GetCommentById(Guid.NewGuid()), "GetCommentById does not throw exception when the user does not exist");
Assert.AreEqual(EXCEPTION_MESSAGE, ex.Message);
}
@@ -157,7 +157,7 @@ namespace DevHive.Services.Tests
_ = this.CommentRepositoryMock.Setup(p => p.GetByIdAsync(It.IsAny<Guid>())).Returns(Task.FromResult<Comment>(null));
_ = this.UserRepositoryMock.Setup(p => p.GetByIdAsync(It.IsAny<Guid>())).Returns(Task.FromResult(user));
- Exception ex = Assert.ThrowsAsync<ArgumentException>(() => this.CommentService.GetCommentById(new Guid()));
+ Exception ex = Assert.ThrowsAsync<ArgumentException>(() => this.CommentService.GetCommentById(Guid.NewGuid()));
Assert.AreEqual(exceptionMessage, ex.Message, "Incorecct exception message");
}
diff --git a/src/Services/DevHive.Services.Tests/LanguageService.Tests.cs b/src/Services/DevHive.Services.Tests/LanguageService.Tests.cs
index 731091c..e97ff31 100644
--- a/src/Services/DevHive.Services.Tests/LanguageService.Tests.cs
+++ b/src/Services/DevHive.Services.Tests/LanguageService.Tests.cs
@@ -105,7 +105,7 @@ namespace DevHive.Services.Tests
[Test]
public async Task GetLanguageById_ReturnsTheLanguage_WhenItExists()
{
- Guid id = new Guid();
+ Guid id = Guid.NewGuid();
string name = "Gosho Trapov";
Language language = new Language
{
@@ -128,7 +128,7 @@ namespace DevHive.Services.Tests
public void GetLanguageById_ThrowsException_WhenLanguageDoesNotExist()
{
string exceptionMessage = "The language does not exist";
- Guid id = new Guid();
+ Guid id = Guid.NewGuid();
this.LanguageRepositoryMock.Setup(p => p.GetByIdAsync(It.IsAny<Guid>())).Returns(Task.FromResult<Language>(null));
Exception ex = Assert.ThrowsAsync<ArgumentException>(() => this.LanguageService.GetLanguageById(id));
@@ -233,7 +233,7 @@ namespace DevHive.Services.Tests
[TestCase(false)]
public async Task DeleteLanguage_ShouldReturnIfDeletionIsSuccessfull_WhenLanguageExists(bool shouldPass)
{
- Guid id = new Guid();
+ Guid id = Guid.NewGuid();
Language language = new Language();
this.LanguageRepositoryMock.Setup(p => p.DoesLanguageExistAsync(It.IsAny<Guid>())).Returns(Task.FromResult(true));
@@ -249,7 +249,7 @@ namespace DevHive.Services.Tests
public void DeleteLanguage_ThrowsException_WhenLanguageDoesNotExist()
{
string exceptionMessage = "Language does not exist!";
- Guid id = new Guid();
+ Guid id = Guid.NewGuid();
this.LanguageRepositoryMock.Setup(p => p.DoesLanguageExistAsync(It.IsAny<Guid>())).Returns(Task.FromResult(false));
diff --git a/src/Services/DevHive.Services.Tests/PostService.Tests.cs b/src/Services/DevHive.Services.Tests/PostService.Tests.cs
index 137b8d1..b7f9a9d 100644
--- a/src/Services/DevHive.Services.Tests/PostService.Tests.cs
+++ b/src/Services/DevHive.Services.Tests/PostService.Tests.cs
@@ -107,7 +107,7 @@ namespace DevHive.Services.Tests
[Test]
public async Task GetPostById_ReturnsThePost_WhenItExists()
{
- Guid creatorId = new Guid();
+ Guid creatorId = Guid.NewGuid();
User creator = new User { Id = creatorId };
Post post = new Post
{
@@ -127,7 +127,7 @@ namespace DevHive.Services.Tests
this.UserRepositoryMock.Setup(p => p.GetByIdAsync(It.IsAny<Guid>())).Returns(Task.FromResult(user));
this.MapperMock.Setup(p => p.Map<ReadPostServiceModel>(It.IsAny<Post>())).Returns(readPostServiceModel);
- ReadPostServiceModel result = await this.PostService.GetPostById(new Guid());
+ ReadPostServiceModel result = await this.PostService.GetPostById(Guid.NewGuid());
Assert.AreEqual(MESSAGE, result.Message);
}
@@ -136,7 +136,7 @@ namespace DevHive.Services.Tests
public void GetPostById_ThorwsException_WhenTheUserDoesNotExist()
{
const string EXCEPTION_MESSAGE = "The user does not exist!";
- Guid creatorId = new Guid();
+ Guid creatorId = Guid.NewGuid();
User creator = new User { Id = creatorId };
Post post = new Post
{
@@ -146,7 +146,7 @@ namespace DevHive.Services.Tests
this.PostRepositoryMock.Setup(p => p.GetByIdAsync(It.IsAny<Guid>())).Returns(Task.FromResult(post));
- Exception ex = Assert.ThrowsAsync<ArgumentException>(() => this.PostService.GetPostById(new Guid()), "GetPostById does not throw exception when the user does not exist");
+ Exception ex = Assert.ThrowsAsync<ArgumentException>(() => this.PostService.GetPostById(Guid.NewGuid()), "GetPostById does not throw exception when the user does not exist");
Assert.AreEqual(EXCEPTION_MESSAGE, ex.Message);
}
@@ -155,7 +155,7 @@ namespace DevHive.Services.Tests
public void GetPostById_ThrowsException_WhenCommentDoesNotExist()
{
string exceptionMessage = "The post does not exist!";
- Guid creatorId = new Guid();
+ Guid creatorId = Guid.NewGuid();
User user = new User
{
Id = creatorId,
@@ -164,7 +164,7 @@ namespace DevHive.Services.Tests
this.PostRepositoryMock.Setup(p => p.GetByIdAsync(It.IsAny<Guid>())).Returns(Task.FromResult<Post>(null));
this.UserRepositoryMock.Setup(p => p.GetByIdAsync(It.IsAny<Guid>())).Returns(Task.FromResult(user));
- Exception ex = Assert.ThrowsAsync<ArgumentException>(() => this.PostService.GetPostById(new Guid()));
+ Exception ex = Assert.ThrowsAsync<ArgumentException>(() => this.PostService.GetPostById(Guid.NewGuid()));
Assert.AreEqual(exceptionMessage, ex.Message, "Incorecct exception message");
}
@@ -242,7 +242,7 @@ namespace DevHive.Services.Tests
[TestCase(false)]
public async Task Deletepost_ShouldReturnIfDeletionIsSuccessfull_WhenPostExists(bool shouldPass)
{
- Guid id = new Guid();
+ Guid id = Guid.NewGuid();
Post post = new Post();
this.PostRepositoryMock.Setup(p => p.DoesPostExist(It.IsAny<Guid>())).Returns(Task.FromResult(true));
@@ -258,7 +258,7 @@ namespace DevHive.Services.Tests
public void DeletePost_ThrowsException_WhenPostDoesNotExist()
{
string exceptionMessage = "Post does not exist!";
- Guid id = new Guid();
+ Guid id = Guid.NewGuid();
this.PostRepositoryMock.Setup(p => p.DoesPostExist(It.IsAny<Guid>())).Returns(Task.FromResult(false));
diff --git a/src/Services/DevHive.Services.Tests/RoleService.Tests.cs b/src/Services/DevHive.Services.Tests/RoleService.Tests.cs
index 29d5df2..f12ddc5 100644
--- a/src/Services/DevHive.Services.Tests/RoleService.Tests.cs
+++ b/src/Services/DevHive.Services.Tests/RoleService.Tests.cs
@@ -103,7 +103,7 @@ namespace DevHive.Services.Tests
[Test]
public async Task GetRoleById_ReturnsTheRole_WhenItExists()
{
- Guid id = new Guid();
+ Guid id = Guid.NewGuid();
string name = "Gosho Trapov";
Role role = new Role
{
@@ -126,7 +126,7 @@ namespace DevHive.Services.Tests
public void GetRoleById_ThrowsException_WhenRoleDoesNotExist()
{
string exceptionMessage = "Role does not exist!";
- Guid id = new Guid();
+ Guid id = Guid.NewGuid();
this.RoleRepositoryMock.Setup(p => p.GetByIdAsync(It.IsAny<Guid>())).Returns(Task.FromResult<Role>(null));
Exception ex = Assert.ThrowsAsync<ArgumentException>(() => this.RoleService.GetRoleById(id));
@@ -201,7 +201,7 @@ namespace DevHive.Services.Tests
[TestCase(false)]
public async Task DeleteRole_ShouldReturnIfDeletionIsSuccessfull_WhenRoleExists(bool shouldPass)
{
- Guid id = new Guid();
+ Guid id = Guid.NewGuid();
Role role = new Role();
this.RoleRepositoryMock.Setup(p => p.DoesRoleExist(It.IsAny<Guid>())).Returns(Task.FromResult(true));
@@ -217,7 +217,7 @@ namespace DevHive.Services.Tests
public void DeleteRole_ThrowsException_WhenRoleDoesNotExist()
{
string exceptionMessage = "Role does not exist!";
- Guid id = new Guid();
+ Guid id = Guid.NewGuid();
this.RoleRepositoryMock.Setup(p => p.DoesRoleExist(It.IsAny<Guid>())).Returns(Task.FromResult(false));
diff --git a/src/Services/DevHive.Services.Tests/TechnologyServices.Tests.cs b/src/Services/DevHive.Services.Tests/TechnologyServices.Tests.cs
index a43d4b9..b53fc03 100644
--- a/src/Services/DevHive.Services.Tests/TechnologyServices.Tests.cs
+++ b/src/Services/DevHive.Services.Tests/TechnologyServices.Tests.cs
@@ -104,7 +104,7 @@ namespace DevHive.Services.Tests
[Test]
public async Task GetTechnologyById_ReturnsTheTechnology_WhenItExists()
{
- Guid id = new Guid();
+ Guid id = Guid.NewGuid();
string name = "Gosho Trapov";
Technology technology = new()
{
@@ -127,7 +127,7 @@ namespace DevHive.Services.Tests
public void GetTechnologyById_ThrowsException_WhenTechnologyDoesNotExist()
{
string exceptionMessage = "The technology does not exist";
- Guid id = new Guid();
+ Guid id = Guid.NewGuid();
this.TechnologyRepositoryMock.Setup(p => p.GetByIdAsync(It.IsAny<Guid>())).Returns(Task.FromResult<Technology>(null));
Exception ex = Assert.ThrowsAsync<ArgumentException>(() => this.TechnologyService.GetTechnologyById(id));
@@ -233,7 +233,7 @@ namespace DevHive.Services.Tests
[TestCase(false)]
public async Task DeleteTechnology_ShouldReturnIfDeletionIsSuccessfull_WhenTechnologyExists(bool shouldPass)
{
- Guid id = new Guid();
+ Guid id = Guid.NewGuid();
Technology technology = new Technology();
this.TechnologyRepositoryMock.Setup(p => p.DoesTechnologyExistAsync(It.IsAny<Guid>())).Returns(Task.FromResult(true));
@@ -249,7 +249,7 @@ namespace DevHive.Services.Tests
public void DeleteTechnology_ThrowsException_WhenTechnologyDoesNotExist()
{
string exceptionMessage = "Technology does not exist!";
- Guid id = new Guid();
+ Guid id = Guid.NewGuid();
this.TechnologyRepositoryMock.Setup(p => p.DoesTechnologyExistAsync(It.IsAny<Guid>())).Returns(Task.FromResult(false));
diff --git a/src/Services/DevHive.Services.Tests/UserService.Tests.cs b/src/Services/DevHive.Services.Tests/UserService.Tests.cs
index 2554706..946514b 100644
--- a/src/Services/DevHive.Services.Tests/UserService.Tests.cs
+++ b/src/Services/DevHive.Services.Tests/UserService.Tests.cs
@@ -388,7 +388,7 @@ namespace DevHive.Services.Tests
// [TestCase(false)]
// public async Task DeleteUser_ShouldReturnIfDeletionIsSuccessfull_WhenUserExists(bool shouldPass)
// {
- // Guid id = new Guid();
+ // Guid id = Guid.NewGuid();
// User user = new User();
//
// this._userRepositoryMock.Setup(p =>