public void Find_Found()
        {
            var card = _repository.Find(CARD_NAME);

            Assert.NotNull(card);
            Assert.Equal("Opt", card.Name);
        }
Beispiel #2
0
 public string AddPlayerCard(string username, string cardName)
 {
     if (playerRepository.Find(username) != null && cardRepository.Find(cardName) != null)
     {
         IPlayer a = playerRepository.Find(username);
         ICard   c = cardRepository.Find(username);
         a.CardRepository.Add(c);
         return($"Successfully added card: {c.Name} to user: {a.Username}");
     }
     return(null);
 }
Beispiel #3
0
        public string AddPlayerCard(string username, string cardName)
        {
            Player current = (Player)playerRepository.Find(username);

            current.CardRepository.Add(cardRepository.Find(cardName));

            return($"Successfully added card: {cardName} to user: {username}");
        }
Beispiel #4
0
        public string AddPlayerCard(string username, string cardName)
        {
            IPlayer player = playerRepository.Find(username);
            ICard   card   = cardRepository.Find(cardName);

            player.CardRepository.Add(card);

            return($"Successfully added card: {cardName} to user: {username}");
        }
Beispiel #5
0
        public string AddPlayerCard(string username, string cardName)
        {
            IPlayer player = playerRepository.Find(username);
            ICard   card   = cardRepository.Find(cardName);

            player.CardRepository.Add(card);

            return(result = string.Format(ConstantMessages.SuccessfullyAddedPlayerWithCards, cardName, username));
        }
Beispiel #6
0
        public void Create_Card()
        {
            var user        = UserFaker.Create();
            var column      = BoardColumnFaker.Create(user);
            var name        = "testName" + Rand.Int();
            var columnOrder = Rand.IntRange(1, 30);

            var card = CardRepository.CreateAndGet(name, "", columnOrder, column, user);

            card = CardRepository.Find(name, user, column);
            Assert.AreEqual(card.name, name);
            Assert.AreEqual(card.column_id, column.id);
        }
Beispiel #7
0
        public static bool HasEntityPermission(User user, int entityId, EntityType entityType)
        {
            if (!EntityUtils.IsEntityExists(entityId, entityType))
            {
                return(false);
            }
            switch (entityType)
            {
            case EntityType.Project:
                var project = ProjectRepository.Find(entityId);
                if (project != null && ProjectTeamMemberRepository.IsExists(project, user))
                {
                    return(true);
                }
                break;

            case EntityType.Board:
                var board = BoardRepository.Find(entityId);
                if (board != null && ProjectTeamMemberRepository.IsExists(board.Project(), user))
                {
                    return(true);
                }
                break;

            case EntityType.BoardColumn:
                var column = BoardColumnRepository.Find(entityId);
                if (column != null && ProjectTeamMemberRepository.IsExists(column.Board().Project(), user))
                {
                    return(true);
                }
                break;

            case EntityType.Card:
                var card = CardRepository.Find(entityId);
                // TODO: optimize?
                if (card != null && ProjectTeamMemberRepository.IsExists(card.Column().Board().Project(), user))
                {
                    return(true);
                }
                break;
            }
            return(false);
        }
        public void Delete_DataCorrect_CardDeleted()
        {
            var browser = new Browser(new DefaultNancyBootstrapper());

            var me   = UserFaker.Create();
            var card = CardFaker.Create(me);

            Assert.NotNull(CardRepository.Find(card.id));

            var result = browser.Delete("/api/v1/card/delete", with => {
                with.HttpRequest();
                with.Query("api_token", Jwt.FromUserId(me.id));
                with.Query("card_guid", card.guid);
            }).Result;

            Assert.AreEqual(HttpStatusCode.OK, result.StatusCode);

            Assert.IsNull(CardRepository.Find(card.id));
        }
Beispiel #9
0
 public Card.Card Card() => CardRepository.Find(card_id);