Exemple #1
0
        public void should_register_new_admin_after_signin()
        {
            _adminApp.MockAdminUser();
            var newAdminUser = new UserViewModel
            {
                UserName = StringUtility.Random(),
                Password = "******"
            };

            var accountController = _adminApp.CreateController <AccountController>();
            var apiResponse       = accountController.Register(newAdminUser);


            var found = _adminUserRepo.All().Any(u => u.Username == newAdminUser.UserName);

            Assert.Equal(200, apiResponse.Code);
            Assert.True(found);
        }
Exemple #2
0
        public async Task should_allow_access_by_admin_user()
        {
            _app.MockAdminUser();
            var request = _app.Server.CreateRequest("/api/topics/999");


            var response = await request.SendAsync(HttpMethod.Delete.ToString());

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);


            var jsonContent = response.ReadAllContent();
            var apiRes      = JsonConvert.DeserializeObject <ApiResponse>(jsonContent);

            Assert.Equal(404, apiRes.Code);
        }