Ejemplo n.º 1
0
        public async Task Get()
        {
            try
            {
                await _context.GetContext();

                var controller = new CartController(_context.Context, MockHelper.MockHttpContextAccessor(_context.Context), MockHelper.MockLogger <CartController>());

                var result = await controller.Get();

                result.Should().BeOfType <OkObjectResult>();
            }
            finally
            {
                _context.Close();
            }
        }
        public async Task GetMovies()
        {
            try
            {
                await _context.GetContext();

                var controller = new CinemaworldController(_context.Context, MockHelper.MockLogger <CinemaworldController>());
                var request    = new MovieRequest {
                    Page = 2, PageSize = 5
                };

                var result = await controller.GetMovies(request);

                result.Should().BeOfType <OkObjectResult>();
            }
            finally
            {
                _context.Close();
            }
        }
Ejemplo n.º 3
0
        public async Task Post(CustomerRegistrationViewModel mockModel)
        {
            try
            {
                await _context.GetContext();

                var controller = new AccountsController(MockHelper.GetUserManager(new UserStore <AppUser>(_context.Context)), MockHelper.Mapper.Value, _context.Context, MockHelper.MockLogger <AccountsController>());

                var result = await controller.Post(mockModel);

                result.Should().BeOfType <OkObjectResult>().Which.Value.Should().Be("Account created");
            }
            finally
            {
                _context.Close();
            }
        }
Ejemplo n.º 4
0
        public async Task Post(AppUser mockUser, CredentialsViewModel mockModel)
        {
            try
            {
                await _context.GetContext();

                var controller = new AuthController(MockHelper.MockUserManager(mockUser), MockHelper.MockJwtFactory(), MockHelper.MockJwtoptions(), MockHelper.MockLogger <AuthController>());
                mockModel.Password = mockModel.Password.Substring(12);

                var result = await controller.Post(mockModel);

                result.Should().BeOfType <OkObjectResult>();
            }
            finally
            {
                _context.Close();
            }
        }