diff options
| author | transtrike <transtrike@gmail.com> | 2021-02-05 19:00:24 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2021-02-05 19:00:24 +0200 |
| commit | 75eeb4358e746d887677903052ed4bd5ca176f4d (patch) | |
| tree | 9f9b9eb0103d61f488c08fa4b4b5f308ca9ab35a /src/DevHive.Tests/DevHive.Data.Tests/PostRepository.Tests.cs | |
| parent | 51e157d1e1dc57ea2ba9c29b355fa7982a29bebe (diff) | |
| parent | 4eb5ccdfc8ee4ac9795c48c701e565dbe2b641f9 (diff) | |
| download | DevHive-75eeb4358e746d887677903052ed4bd5ca176f4d.tar DevHive-75eeb4358e746d887677903052ed4bd5ca176f4d.tar.gz DevHive-75eeb4358e746d887677903052ed4bd5ca176f4d.zip | |
Merge branch 'dev' of github.com:Team-Kaleidoscope/DevHive into dev
Diffstat (limited to 'src/DevHive.Tests/DevHive.Data.Tests/PostRepository.Tests.cs')
| -rw-r--r-- | src/DevHive.Tests/DevHive.Data.Tests/PostRepository.Tests.cs | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/DevHive.Tests/DevHive.Data.Tests/PostRepository.Tests.cs b/src/DevHive.Tests/DevHive.Data.Tests/PostRepository.Tests.cs index 7d80f1f..6dacf0b 100644 --- a/src/DevHive.Tests/DevHive.Data.Tests/PostRepository.Tests.cs +++ b/src/DevHive.Tests/DevHive.Data.Tests/PostRepository.Tests.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using DevHive.Data.Interfaces.Repositories; using DevHive.Data.Models; +using DevHive.Data.RelationModels; using DevHive.Data.Repositories; using Microsoft.EntityFrameworkCore; using Moq; @@ -11,7 +11,7 @@ using NUnit.Framework; namespace DevHive.Data.Tests { - [TestFixture] + [TestFixture] public class PostRepositoryTests { private const string POST_MESSAGE = "Post test message"; @@ -44,18 +44,18 @@ namespace DevHive.Data.Tests #endregion #region AddNewPostToCreator - [Test] - public async Task AddNewPostToCreator_ReturnsTrue_WhenNewPostIsAddedToCreator() - { - Post post = await this.AddEntity(); - User user = new User { Id = Guid.NewGuid() }; - - this.UserRepository.Setup(p => p.GetByIdAsync(It.IsAny<Guid>())).Returns(Task.FromResult(user)); - - bool result = await this.PostRepository.AddNewPostToCreator(user.Id, post); - - Assert.IsTrue(result, "AddNewPostToCreator does not return true when Post Is Added To Creator successfully"); - } + // [Test] + // public async Task AddNewPostToCreator_ReturnsTrue_WhenNewPostIsAddedToCreator() + // { + // Post post = await this.AddEntity(); + // User user = new User { Id = Guid.NewGuid() }; + // + // this.UserRepository.Setup(p => p.GetByIdAsync(It.IsAny<Guid>())).Returns(Task.FromResult(user)); + // + // bool result = await this.PostRepository.AddNewPostToCreator(user.Id, post); + // + // Assert.IsTrue(result, "AddNewPostToCreator does not return true when Post Is Added To Creator successfully"); + // } #endregion #region GetByIdAsync @@ -124,13 +124,14 @@ namespace DevHive.Data.Tests private async Task<Post> AddEntity(string name = POST_MESSAGE) { User creator = new User { Id = Guid.NewGuid() }; + await this.Context.Users.AddAsync(creator); Post post = new Post { Message = POST_MESSAGE, Id = Guid.NewGuid(), Creator = creator, TimeCreated = DateTime.Now, - FileUrls = new List<string>(), + Attachments = new List<PostAttachments> { new PostAttachments { FileUrl = "kur" }, new PostAttachments { FileUrl = "za" }, new PostAttachments { FileUrl = "tva" } }, Comments = new List<Comment>() }; |
