Exemplo n.º 1
0
        private static async Task <TypeCardsService> PrepareService()
        {
            ApplicationDbContext db = GetDb();

            var repository = new EfDeletableEntityRepository <TypeCard>(db);
            var service    = new TypeCardsService(repository);

            var firstTypeCard = new TypeCard()
            {
                Id    = "1",
                Price = 50,
            };

            var secondTypeCard = new TypeCard()
            {
                Id    = "2",
                Price = 250,
            };

            await db.TypeCards.AddAsync(firstTypeCard);

            await db.TypeCards.AddAsync(secondTypeCard);

            await db.SaveChangesAsync();

            return(service);
        }
Exemplo n.º 2
0
        public async Task CheckGettingPriceAsync()
        {
            TypeCardsService service = await PrepareService();

            var price = await service.GetPriceAsync("1");

            Assert.Equal(50, price);
        }
Exemplo n.º 3
0
        public async Task CheckGettingAllAsync()
        {
            TypeCardsService service = await PrepareService();

            var typeCards = await service.GetAllAsync <TestTypeCardModel>();

            Assert.Equal(2, typeCards.Count());
        }