Пример #1
0
        public async Task GetAsyncTest()
        {
            var r1 = new Round
            {
                Name   = "First",
                Topics = new List <Topic>
                {
                    new Topic
                    {
                        Name      = "C#",
                        Questions = new List <Question>
                        {
                            new Question
                            {
                                Text  = "g",
                                Price = 100
                            }
                        }
                    },
                    new Topic
                    {
                        Name      = "Java",
                        Questions = new List <Question>
                        {
                            new Question
                            {
                                Text  = "g",
                                Price = 200
                            }
                        }
                    }
                }
            };
            var r2 = new Round
            {
                Name   = "Second",
                Topics = new List <Topic>
                {
                    new Topic
                    {
                        Name      = "C#",
                        Questions = new List <Question>
                        {
                            new Question
                            {
                                Text  = "g",
                                Price = 100
                            }
                        }
                    },
                    new Topic
                    {
                        Name      = "Java",
                        Questions = new List <Question>
                        {
                            new Question
                            {
                                Text  = "g",
                                Price = 200
                            }
                        }
                    }
                }
            };

            _db.Rounds.Add(r1);
            _db.Rounds.Add(r2);

            _db.SaveChanges();

            var list = new List <Round> {
                r1, r2
            };

            var rounds = await _roundService.GetAsync();

            _db.Rounds.Remove(r1);
            _db.Rounds.Remove(r2);

            _db.SaveChanges();

            Assert.IsTrue(Enumerable.SequenceEqual(list, rounds));
        }
Пример #2
0
 public async Task <IEnumerable <RoundDto> > Get(Guid id)
 {
     return(await service.GetAsync(id));
 }