Ejemplo n.º 1
0
        public static Mock <ITextRepository> MockCreateBookmarkAsync(this Mock <ITextRepository> source,
                                                                     CreateBookmark createBookmark)
        {
            source
            .Setup(x => x.CreateBookmarkAsync(createBookmark))
            .Returns(Task.CompletedTask)
            .Verifiable();

            return(source);
        }
Ejemplo n.º 2
0
        public Task CreateBookmarkAsync(CreateBookmark createBookmark)
        {
            _dbContext.Bookmarks.Add(new Bookmark
            {
                TextId = createBookmark.TextId,
                UserId = createBookmark.UserId
            });

            return(_dbContext.SaveChangesAsync());
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ (FieldsCollection != null ? FieldsCollection.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DisplayName != null ? DisplayName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ UpdateAllOccurrences.GetHashCode();
         hashCode = (hashCode * 397) ^ CreateBookmark.GetHashCode();
         hashCode = (hashCode * 397) ^ (ServiceHost != null ? ServiceHost.GetHashCode() : 0);
         return(hashCode);
     }
 }
Ejemplo n.º 4
0
        public async Task CreateBookmarkAsync_Ok()
        {
            var createBookmark = new CreateBookmark(1, 1);

            var textRepository = CreateTextRepositoryMock()
                                 .MockExist(1, true)
                                 .MockCreateBookmarkAsync(createBookmark)
                                 .Resolve();

            var userRepository = CreateUserRepositoryMock()
                                 .MockExistAsync(1, true)
                                 .Resolve();

            var text = new TextBusiness(textRepository, userRepository);
            await text.CreateBookmarkAsync(createBookmark);
        }
Ejemplo n.º 5
0
        public async Task CreateBookmarkASync_TextIdNotFound()
        {
            var createBookmark = new CreateBookmark(1, 1);

            var textRepository = CreateTextRepositoryMock()
                                 .MockExist(1, false)
                                 .Resolve();

            var userRepository = CreateUserRepositoryMock()
                                 .MockExistAsync(1, true)
                                 .Resolve();

            var text = new TextBusiness(textRepository, userRepository);

            var notFoundException =
                await ThrowsAsync <NotFoundException>(() => text.CreateBookmarkAsync(createBookmark));

            Equal("TextId not found", notFoundException.Message);
        }
Ejemplo n.º 6
0
        public void InitiateGame()
        {
            Game game = new Game()
            {
                Guess        = 10,
                Id           = Guid.NewGuid(),
                MaxNumber    = 10,
                Result       = "Testing Update activites",
                Turns        = 500,
                WorkflowType = "Workflow"
            };

            CreateBookmark initiateGame           = new CreateBookmark();
            Dictionary <string, object> gameInput = new Dictionary <string, object>();

            gameInput.Add("Game", game);

            var result = (Game)WorkflowInvoker.Invoke(initiateGame, gameInput);

            Assert.IsNotNull(result, "Check failed");
        }
        public bool Equals(DsfDotNetMultiAssignActivity other)
        {
            if (FieldsCollection.Count != other.FieldsCollection.Count)
            {
                return(false);
            }

            var eq = base.Equals(other);

            for (int i = 0; i < FieldsCollection.Count; i++)
            {
                eq &= FieldsCollection[i].Equals(other.FieldsCollection[i]);
            }
            eq &= UpdateAllOccurrences.Equals(other.UpdateAllOccurrences);
            eq &= CreateBookmark.Equals(other.CreateBookmark);
            if (!(ServiceHost is null))
            {
                eq &= ServiceHost.Equals(other.ServiceHost);
            }

            return(eq);
        }