예제 #1
0
        public async void TestCRUDList(List <Player> newPlayers, JsonElement updateCondition, JsonElement updateToken)
        {
            // Add many
            CUDMessage addMessage = await playerService.AddList(newPlayers);

            Assert.True(addMessage.OK);
            List <Player> playersInDB = await playerService.GetList(JsonDocument.Parse("{}").RootElement);

            Assert.True(playersInDB.Count == 3);
            // update many
            CUDMessage updateMessage = await playerService.UpdateList(updateCondition, updateToken);

            Assert.Equal(2, updateMessage.NumAffected);
            playersInDB = await playerService.GetList(JsonDocument.Parse("{}").RootElement);

            Assert.Equal(2, playersInDB[2].CDKeys.Count);
            // delete many
            CUDMessage deleteMessage = await playerService.DeleteList(updateCondition);

            Assert.True(deleteMessage.NumAffected == 2);
            playersInDB = await playerService.GetList(JsonDocument.Parse("{}").RootElement);

            Assert.True(playersInDB.Count == 1);
        }