public async Task ReturnsBoardWithProperOwnerAndName()
            {
                string name                = "test";
                string username            = "******";
                string password            = "******";
                User   owner               = new User(username, password);
                var    boardRepositoryMock = new Mock <IBoardRepository>();
                var    boardEditingService = new BoardEditingService(boardRepositoryMock.Object);
                var    board               = await boardEditingService.CreateNewBoardAsync(name, owner);

                Assert.True(board.Name == name, "Board.Name was not set correctly");
                Assert.True(board.Owner == owner, "Board.Owner was not set correctly");
            }
Esempio n. 2
0
        protected void Cancel()
        {
            try
            {
                Failures.Clear();

                BoardEditingService.Cancel();
            }
            catch (Exception ex)
            {
                Program.Logger.Log(NLog.LogLevel.Error, ex);
                NavigationManager.NavigateTo("error");
            }
        }
Esempio n. 3
0
        protected void Save(bool?runBoardAfterSaving = false)
        {
            try
            {
                var boardToSave = SanitizeBoard(BoardToEdit);

                Failures = BoardValidationService.Validate(boardToSave);

                if (!Failures.Any())
                {
                    BoardEditingService.SaveBoard(boardToSave, runBoardAfterSaving != null && runBoardAfterSaving.Value);
                }
            }
            catch (Exception ex)
            {
                Program.Logger.Log(NLog.LogLevel.Error, ex);
                NavigationManager.NavigateTo("error");
            }
        }
            public async Task TopicsGetAddedToBoardWithAnswers()
            {
                Board        board;
                Guid         id     = new Guid("5cb3d6d1-036f-476e-b904-d844b86fd69f");
                List <Topic> topics = new List <Topic>();
                var          topic1 = new Topic("topic1", new List <Answer>());
                var          topic2 = new Topic("topic2", new List <Answer>());

                topics.Add(topic1);
                topics.Add(topic2);
                board = new Board("test", topics);

                var boardRepository = new FakeBoardRepository();
                await boardRepository.AddAsync(board);

                var boardEditingService = new BoardEditingService(boardRepository);

                var updatedBoard = await boardEditingService.SaveBoardAsync(board);

                Assert.True(updatedBoard.Topics.Count() == 2, "Topics were not updated correctly");
            }