Exemplo n.º 1
0
        public async Task GetSellers_Should_Return_List_Of_Sellers()
        {
            // Arrange
            await _dbContext.Database.EnsureDeletedAsync();

            var listOfSellers = new List <tblSellers>();

            listOfSellers.Add(new tblSellersBuilder().WithId(1).WithName("Amazon").WithUrl("https://www.amazon.co.uk").Build());
            listOfSellers.Add(new tblSellersBuilder().WithId(2).WithName("Ebay").WithUrl("https://www.ebay.co.uk").Build());
            listOfSellers.Add(new tblSellersBuilder().WithId(3).WithName("Currys PC World").WithUrl("https://www.currys.co.uk").Build());
            _dbContext.tblSellers.AddRange(listOfSellers);

            await _dbContext.SaveChangesAsync();

            // Act
            var task   = _userSettingsService.GetSellers();
            var result = task.Result;

            Assert.IsAssignableFrom <IEnumerable <Seller> >(result);
            Assert.Equal(3, result.Count());
        }