Пример #1
0
        public async void GetLevelsInSet()
        {
            // arrange
            await using InWordsDataContext context = InWordsDataContextFactory.Create();
            var game1 = new Game();

            context.Add(game1);

            List <GameLevel> gameLevels = new List <GameLevel>
            {
                new GameLevel()
                {
                    GameId = game1.GameId,
                },
                new GameLevel()
                {
                    GameId = game1.GameId,
                }
            };

            context.AddRange(gameLevels);
            await context.SaveChangesAsync();

            // act
            var data = new GetLevelsRequest()
            {
                WordSetId = game1.GameId
            };
            var request = new AuthReq <GetLevelsRequest, GetLevelsReply>(data);
            var handler = new GetWordSetLevels(context);
            var result  = await handler.Handle(request);

            // assert
            Assert.Equal(2, result.Levels.Count);
        }