Exemplo n.º 1
0
        public async void Cart_Test_ShouldThrowAnArgumentNullException()
        {
            using (var context = new ApplicationDbContext(CreateNewContextOptions()))
            {
                await SetUp(context);

                _cartController = new Mock <Webshop.Controllers.CartController>(context, _mapper, _userManager).Object;

                var ex = Assert.ThrowsAsync <ArgumentNullException>(() => _cartController.Get(3));
            }
        }
Exemplo n.º 2
0
        public async void Cart_Test_ShouldReturnTwoCarts()
        {
            using (var context = new ApplicationDbContext(CreateNewContextOptions()))
            {
                await SetUp(context);

                _cartController = new Mock <Webshop.Controllers.CartController>(context, _mapper, _userManager).Object;

                List <CartDto> cartDtos = (List <CartDto>) await _cartController.Get();

                Assert.Equal(2, cartDtos.Count);
            }
        }
Exemplo n.º 3
0
        public async void Cart_Test_ShouldReturnCartWithIdOne()
        {
            using (var context = new ApplicationDbContext(CreateNewContextOptions()))
            {
                await SetUp(context);

                _cartController = new Mock <Webshop.Controllers.CartController>(context, _mapper, _userManager).Object;

                var cartDtoFromController = await _cartController.Get(1);

                Assert.NotNull(cartDtoFromController);
            }
        }