コード例 #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);
        }
コード例 #2
0
 public AccountControllerSpecs(TestDiscussionAdminApp adminApp)
 {
     _adminApp      = adminApp;
     _adminUserRepo = adminApp.GetService <IRepository <AdminUser> >();
     _adminApp.Reset();
     _adminApp.DeleteAll <AdminUser>();
 }
コード例 #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));
        }
コード例 #4
0
 public TopicManagementControllerSpecs(TestDiscussionAdminApp adminApp)
 {
     _adminApp = adminApp;
     _adminApp.DeleteAll <Topic>();
 }
コード例 #5
0
 public ArticleRepoSpecs(TestDiscussionAdminApp app)
 {
     services = app.ApplicationServices;
     app.DeleteAll <Article>();
 }