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); }
public AccountControllerSpecs(TestDiscussionAdminApp adminApp) { _adminApp = adminApp; _adminUserRepo = adminApp.GetService <IRepository <AdminUser> >(); _adminApp.Reset(); _adminApp.DeleteAll <AdminUser>(); }
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>(); }
public ArticleRepoSpecs(TestDiscussionAdminApp app) { services = app.ApplicationServices; app.DeleteAll <Article>(); }