예제 #1
0
        public async Task GetBriefListSeasons_WhenCalled_ReturnSeasonsFromDb()
        {
            var expectedSeasons = new List <Season>()
            {
                new Season {
                    Id = 1
                },
                new Season {
                    Id = 2
                },
                new Season {
                    Id = 3
                },
            };

            _seasonService.Setup(s => s.GetBriefListAsync()).ReturnsAsync(expectedSeasons);

            var result = await _seasonsController.GetBriefListSeasons();

            var okObjectResult      = result as OkObjectResult;
            var okObjectResultValue = okObjectResult.Value as IEnumerable <SeasonBriefListDto>;

            Assert.That(result, Is.TypeOf <OkObjectResult>());

            Assert.That(okObjectResultValue, Is.Not.Null);
            Assert.That(okObjectResultValue.Count(), Is.EqualTo(3));
        }