Exemple #1
0
        public async Task should_serve_register_api()
        {
            _app.DeleteAll <AdminUser>();
            var request = _app.Server.CreateRequest("/api/account/register");

            var response = await request
                           .WithJson(new { userName = StringUtility.Random(), password = "******" })
                           .PostAsync();

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            var jsonContent = response.ReadAllContent();
            var apiRes      = JsonConvert.DeserializeObject <ApiResponse>(jsonContent);

            Assert.Equal(200, apiRes.Code);
        }
Exemple #2
0
 public AccountControllerSpecs(TestDiscussionAdminApp adminApp)
 {
     _adminApp      = adminApp;
     _adminUserRepo = adminApp.GetService <IRepository <AdminUser> >();
     _adminApp.Reset();
     _adminApp.DeleteAll <AdminUser>();
 }
Exemple #3
0
        private void Create30Articles()
        {
            var repo = _adminApp.GetService <IRepository <Article> >();

            _adminApp.DeleteAll <Article>();
            Enumerable.Range(1, 30)
            .Select(number => $"queryable {number}")
            .Select(title => new Article {
                Title = title
            })
            .ToList()
            .ForEach(article => repo.Save(article));
        }
 public TopicManagementControllerSpecs(TestDiscussionAdminApp adminApp)
 {
     _adminApp = adminApp;
     _adminApp.DeleteAll <Topic>();
 }
Exemple #5
0
 public ArticleRepoSpecs(TestDiscussionAdminApp app)
 {
     services = app.ApplicationServices;
     app.DeleteAll <Article>();
 }