public void CreateAccount()
 {
     Database.SetInitializer(new ManahostManagerInitializer());
     using (ManahostManagerDAL prectx = new ManahostManagerDAL())
     {
         prectx.Database.Delete();
     }
     var AccountModel = new CreateAccountModel()
     {
         Civility = "Mr",
         Country = "France",
         Email = "*****@*****.**",
         FirstName = "Fabrice",
         LastName = "Didierjean",
         Password = "******",
         PasswordConfirmation = "TOTOTITi88$$"
     };
     HttpResponseMessage result;
     using (var server = TestServer.Create<WebApiApplication>())
     {
         result = server.CreateRequest("/api/Account").And(x =>
         {
             x.Content = new ObjectContent(typeof(CreateAccountModel), AccountModel, new JilFormatter());
             x.Content.Headers.ContentType = new MediaTypeHeaderValue(GenericNames.APP_JSON);
         }).PostAsync().Result;
         string msg = result.Content.ReadAsStringAsync().Result;
         Assert.AreEqual(HttpStatusCode.OK, result.StatusCode, "Status Create Account" + msg);
     }
 }
Exemplo n.º 2
0
 public static Client Create(CreateAccountModel model)
 {
     return new Client()
     {
         Email = model.Email,
         EmailConfirmed = false,
         PhoneNumberConfirmed = false,
         DateCreation = DateTime.Now,
         DateModification = null,
         DefaultHomeId = null,
         TwoFactorEnabled = false,
         InitManager = false,
         TutorialManager = false,
         Locale = "fr-FR",
         Timezone = model.Timezone,
         Country = model.Country,
         FirstName = model.FirstName,
         LastName = model.LastName,
         Civility = model.Civility,
         IsManager = false,
         AcceptMailing = false,
         DateBirth = null
     };
 }