public static async Task<Service> GetServiceActiveAndExists(ManahostManagerDAL ctx, string client_id, string client_secret)
        {
            if (client_id == null)
            {
                throw new AuthenticationToolsException("client_id", GenericError.INVALID_GIVEN_PARAMETER);
            }

            var ServiceRepo = new ServiceRepository(ctx);
            var service = await ServiceRepo.GetUniqAsync(x => x.Id == client_id);
            if (service == null)
            {
                throw new AuthenticationToolsException("client_id", GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST);
            }
            if (service.ApplicationType == ApplicationTypes.NATIVE_CLIENT)
            {
                if (string.IsNullOrWhiteSpace(client_secret))
                {
                    throw new AuthenticationToolsException("client_secret", GenericError.INVALID_GIVEN_PARAMETER);
                }
                if (new BcryptPasswordHasher().VerifyHashedPassword(service.Secret, client_secret) == PasswordVerificationResult.Failed)
                {
                    throw new AuthenticationToolsException("client_secret", GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST);
                }
            }
            if (!service.Active)
            {
                throw new AuthenticationToolsException("client_id", GenericError.CLIENT_DISABLED);
            }
            return service;
        }
        public void ChangePassword()
        {
            Database.SetInitializer(new ManahostManagerInitializer());
            using (ManahostManagerDAL prectx = new ManahostManagerDAL())
            {
                prectx.Database.Delete();
            }
            var passwordModel = new ChangePasswordAccountModel()
            {
                CurrentPassword = ControllerUtils.password,
                Password = "******",
                PasswordConfirmation = "JeSuisUnNooB88$$"
            };
            using (var server = TestServer.Create<WebApiApplication>())
            {
                HttpResponseMessage response = server.CreateRequest("/token").And((x) => x.Content = new StringContent(string.Format("grant_type=password&username={0}&password={1}&client_id=UNITTEST&client_secret=BLAHBLAHCAR", ControllerUtils.username, ControllerUtils.password), Encoding.UTF8, "application/x-www-form-urlencoded")).PostAsync().Result;
                TokenAuth token = response.Content.ReadAsAsync<TokenAuth>().Result;
                Assert.AreEqual(response.StatusCode, HttpStatusCode.OK, "Status Authentication");

                var result = server.CreateRequest("/api/Account/Password").And(x =>
               {
                   x.Content = new ObjectContent(typeof(ChangePasswordAccountModel), passwordModel, new JilFormatter());
                   x.Content.Headers.ContentType = new MediaTypeHeaderValue(GenericNames.APP_JSON);
               }).AddHeader("Authorization", new AuthenticationHeaderValue("Bearer", token.access_token).ToString()).PostAsync().Result;
                Assert.AreEqual(HttpStatusCode.OK, result.StatusCode, "Status Change Password");

                response = server.CreateRequest("/token").And((x) => x.Content = new StringContent(string.Format("grant_type=password&username={0}&password={1}&client_id=UNITTEST&client_secret=BLAHBLAHCAR", ControllerUtils.username, "JeSuisUnNooB88$$"), Encoding.UTF8, "application/x-www-form-urlencoded")).PostAsync().Result;
                Assert.AreEqual(response.StatusCode, HttpStatusCode.OK, "Status Authentication with new password");
                token = response.Content.ReadAsAsync<TokenAuth>().Result;
            }
        }
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new HomeConfigRepository(ctx);
     using (UserManager<Client, int> manager = new ClientUserManager(new CustomUserStore(ctx)))
     {
         entity = new HomeConfig()
         {
             Home = new Home()
             {
                 Title = "LaCorderieTest",
                 EstablishmentType = EEstablishmentType.BB,
                 Client = manager.FindByEmail("*****@*****.**"),
             },
             AutoSendSatisfactionEmail = false,
             DepositNotifEnabled = false,
             Devise = "$",
             EnableDinner = false,
             EnableDisplayActivities = false,
             EnableDisplayMeals = false,
             EnableDisplayProducts = false,
             EnableDisplayRooms = false,
             EnableReferencing = false,
             FollowStockEnable = false,
             HourFormat24 = true
         };
     }
     repo.Add(entity);
     repo.Save();
 }
        public void TrottlingAuthenticate()
        {
            Database.SetInitializer(new ManahostManagerInitializer());
            using (ManahostManagerDAL prectx = new ManahostManagerDAL())
            {
                prectx.Database.Delete();
            }
            using (var server = TestServer.Create<WebApiApplicationThrottle>())
            {
                HttpResponseMessage response = null;
                response = server.CreateRequest("/token").And((x) => x.Content = new StringContent(string.Format("grant_type=password&username={0}&password={1}&client_id=UNITTEST&client_secret=BLAHBLAHCAR", ControllerUtils.username, ControllerUtils.password), Encoding.UTF8, "application/x-www-form-urlencoded")).PostAsync().Result;
                Assert.AreEqual(response.StatusCode, HttpStatusCode.OK, "STATUS AUTHENTIFICATIOn");

                TokenAuth token = response.Content.ReadAsAsync<TokenAuth>().Result;
                AuthenticationHeaderValue headerValueAuthentication = new AuthenticationHeaderValue("Bearer", token.access_token);

                for (int i = 0; i < 4000; i++)
                {
                    response = server.CreateRequest("/api/Account").AddHeader("Authorization", headerValueAuthentication.ToString()).GetAsync().Result;
                    Assert.AreEqual(response.StatusCode, HttpStatusCode.OK, string.Format("STATUS Account GET I : {0}", i));
                }
                response = server.CreateRequest("/api/Account").AddHeader("Authorization", headerValueAuthentication.ToString()).GetAsync().Result;
                Assert.AreEqual((int)response.StatusCode, 429, "STATUS 429");
            }
        }
 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);
     }
 }
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new BookingStepConfigRepository(ctx);
     entity = new BookingStepConfig()
     {
         HomeId = ctx.HomeSet.FirstOrDefault(x => x.Title == "LaCorderie").Id,
         Title = "EFtest"
     };
 }
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new ProductCategoryRepository(ctx);
     entity = new ProductCategory()
     {
         Home = ctx.HomeSet.FirstOrDefault(p => p.Title == "LaCorderie"),
         Title = "EFTest",
         RefHide = false
     };
 }
示例#8
0
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new HomeRepository(ctx);
     repo.includes = new List<string>();
     entity = new Home()
     {
         ClientId = 1,
         EstablishmentType = EEstablishmentType.BB,
         Title = "La corderie TEST"
     };
 }
示例#9
0
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new BedRepository(ctx);
     entity = new Bed()
     {
         HomeId = ctx.HomeSet.FirstOrDefault(p => p.Title == "LaCorderie").Id,
         NumberPeople = 2,
         // TODO
         //RoomId = ctx.RoomSet.FirstOrDefault(p => p.Title == "Melanie").Id
     };
 }
示例#10
0
        public static ManahostManagerDAL CreateContext()
        {
            Database.SetInitializer(new ManahostManagerInitializerTest());
            using (ManahostManagerDAL prectx = new ManahostManagerDAL())
            {
                prectx.Database.Delete();
            }

            ManahostManagerDAL ctx = new ManahostManagerDAL();

            ctx.Database.CommandTimeout = 60;
            return ctx;
        }
示例#11
0
 public void ThrottlingNotAuthenticate()
 {
     Database.SetInitializer(new ManahostManagerInitializer());
     using (ManahostManagerDAL prectx = new ManahostManagerDAL())
     {
         prectx.Database.Delete();
     }
     using (var server = TestServer.Create<WebApiApplicationThrottle>())
     {
         for (int i = 0; i < 600; i++)
         {
             HttpResponseMessage _response = server.CreateRequest("/api/Home").PostAsync().Result;
             Assert.AreEqual(_response.StatusCode, HttpStatusCode.Unauthorized);
         }
         HttpResponseMessage response = server.CreateRequest("/api/Home").PostAsync().Result;
         Assert.AreEqual((int)response.StatusCode, 429);
     }
 }
示例#12
0
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new ProductRepository(ctx);
     entity = new Product()
     {
         Home = ctx.HomeSet.FirstOrDefault(p => p.Title == "LaCorderie"),
         Title = "EFTest",
         Supplier = null,
         PriceHT = 300M,
         ProductCategory = null,
         Stock = 10,
         Tax = null,
         Threshold = 3,
         RefHide = false,
         Hide = false,
         IsUnderThreshold = false
     };
 }
示例#13
0
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new BookingRepository(ctx);
     b = new Booking()
     {
         Comment = "I am a comment",
         DateArrival = DateTime.Now.AddYears(1),
         DateCreation = DateTime.Now,
         DateDeparture = DateTime.Now.AddYears(3),
         DateDesiredPayment = DateTime.Now.AddYears(3).AddMonths(1),
         DateModification = DateTime.Now,
         DateValidation = DateTime.Now.AddMonths(4),
         Home = ctx.HomeSet.FirstOrDefault(x => x.Title == "LaCorderie"),
         IsOnline = false,
         IsSatisfactionSended = false,
         People = new People()
         {
             AcceptMailing = true,
             Addr = "4 place kleber",
             City = "Strasbourg",
             Civility = "Mr",
             Comment = "A mis le feu à la chambre",
             Country = "FRANCE",
             DateBirth = DateTime.Now,
             DateCreation = DateTime.Now,
             Email = "*****@*****.**",
             Firstname = "CHAABANE",
             Home = ctx.HomeSet.FirstOrDefault(x => x.Title == "LaCorderie"),
             Lastname = "Jalal",
             Mark = 0,
             Phone1 = "0600000000",
             Phone2 = null,
             State = null,
             ZipCode = "67000",
             Hide = false
         },
         TotalPeople = 4
     };
 }
示例#14
0
 public BedRepository(ManahostManagerDAL ctx)
     : base(ctx)
 {
 }
示例#15
0
 public GroupBillItemRepository(ManahostManagerDAL dal) : base(dal)
 {
 }
示例#16
0
 public AdditionalBookingRepository(ManahostManagerDAL ctx) : base(ctx)
 {
 }
示例#17
0
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new PeriodRepository(ctx);
 }
示例#18
0
 public void Init()
 {
     ctx  = EFContext.CreateContext();
     repo = new DocumentRepository(ctx);
 }
 public ClientRepository(ManahostManagerDAL ctx)
 {
     _ctx = ctx;
     _userManager = new ClientUserManager(new CustomUserStore(_ctx));
 }
示例#20
0
 public BookingStepRepository(ManahostManagerDAL ctx) : base(ctx)
 {
 }
示例#21
0
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new BookingStepRepository(ctx);
 }
示例#22
0
 public RoomBookingRepository(ManahostManagerDAL ctx) : base(ctx)
 {
 }
示例#23
0
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new PaymentTypeRepository(ctx);
 }
        public void AddPrincipalPhone()
        {
            Database.SetInitializer(new ManahostManagerInitializer());
            using (ManahostManagerDAL prectx = new ManahostManagerDAL())
            {
                prectx.Database.Delete();
            }
            var phoneModel = new PhoneModel()
            {
                IsPrimary = true,
                Phone = "0874543215",
                Type = Domain.Entity.PhoneType.MOBILE
            };
            using (var server = TestServer.Create<WebApiApplication>())
            {
                HttpResponseMessage response = server.CreateRequest("/token").And((x) => x.Content = new StringContent(string.Format("grant_type=password&username={0}&password={1}&client_id=UNITTEST&client_secret=BLAHBLAHCAR", ControllerUtils.username, ControllerUtils.password), Encoding.UTF8, "application/x-www-form-urlencoded")).PostAsync().Result;
                TokenAuth token = response.Content.ReadAsAsync<TokenAuth>().Result;
                Assert.AreEqual(response.StatusCode, HttpStatusCode.OK, "Status Authentication");

                var result = server.CreateRequest("/api/Account").AddHeader("Authorization", new AuthenticationHeaderValue("Bearer", token.access_token).ToString()).GetAsync().Result;
                Assert.AreEqual(HttpStatusCode.OK, result.StatusCode, "Status Get Account For delete");
                var msg = result.Content.ReadAsAsync<ExposeAccountModel>().Result;

                result = server.CreateRequest(string.Format("/api/Account/Phone/{0}", msg.PrincipalPhone.Id)).AddHeader("Authorization", new AuthenticationHeaderValue("Bearer", token.access_token).ToString()).SendAsync("DELETE").Result;
                Assert.AreEqual(HttpStatusCode.OK, result.StatusCode, "Status DELETE PHONE NUMBER");

                result = server.CreateRequest("/api/Account/Phone").And(x =>
               {
                   x.Content = new ObjectContent(typeof(PhoneModel), phoneModel, new JilFormatter());
                   x.Content.Headers.ContentType = new MediaTypeHeaderValue(GenericNames.APP_JSON);
               }).AddHeader("Authorization", new AuthenticationHeaderValue("Bearer", token.access_token).ToString()).PostAsync().Result;
                Assert.AreEqual(HttpStatusCode.OK, result.StatusCode, "Status Post New Principal Phone");

                result = server.CreateRequest("/api/Account").AddHeader("Authorization", new AuthenticationHeaderValue("Bearer", token.access_token).ToString()).GetAsync().Result;
                Assert.AreEqual(HttpStatusCode.OK, result.StatusCode, "Status Get Account CHECK");
                msg = result.Content.ReadAsAsync<ExposeAccountModel>().Result;
                Assert.AreEqual(phoneModel.Phone, msg.PrincipalPhone.Phone, "Check Principal Phone is Same PhoneNumber");
                Assert.AreEqual(phoneModel.Type, msg.PrincipalPhone.PhoneType, "Check Principal Phone is Same Type");

                var phonePutModel = Factory.Create(msg.PrincipalPhone);
                phonePutModel.IsPrimary = true;
                phonePutModel.Phone = "4242424242";
                result = server.CreateRequest(String.Format("/Api/Account/Phone/{0}", msg.PrincipalPhone.Id)).And(x =>
                {
                    x.Content = new ObjectContent(typeof(PhoneModel), phonePutModel, new JilFormatter());
                    x.Content.Headers.ContentType = new MediaTypeHeaderValue(GenericNames.APP_JSON);
                }).AddHeader("Authorization", new AuthenticationHeaderValue("Bearer", token.access_token).ToString()).SendAsync("PUT").Result;
                Assert.AreEqual(HttpStatusCode.OK, result.StatusCode, "Status Put New Principal Phone");

                result = server.CreateRequest("/api/Account").AddHeader("Authorization", new AuthenticationHeaderValue("Bearer", token.access_token).ToString()).GetAsync().Result;
                Assert.AreEqual(HttpStatusCode.OK, result.StatusCode, "Status Get Account for Verif Principal Phone");
                msg = result.Content.ReadAsAsync<ExposeAccountModel>().Result;
                Assert.AreEqual("4242424242", msg.PrincipalPhone.Phone, "Check Principal Phone is same Phone");
            }
        }
        public void AddSecondaryPhone()
        {
            Database.SetInitializer(new ManahostManagerInitializer());
            using (ManahostManagerDAL prectx = new ManahostManagerDAL())
            {
                prectx.Database.Delete();
            }
            var phoneModel = new PhoneModel()
            {
                IsPrimary = false,
                Phone = "0874543215",
                Type = Domain.Entity.PhoneType.WORK
            };
            using (var server = TestServer.Create<WebApiApplication>())
            {
                HttpResponseMessage response = server.CreateRequest("/token").And((x) => x.Content = new StringContent(string.Format("grant_type=password&username={0}&password={1}&client_id=UNITTEST&client_secret=BLAHBLAHCAR", ControllerUtils.username, ControllerUtils.password), Encoding.UTF8, "application/x-www-form-urlencoded")).PostAsync().Result;
                TokenAuth token = response.Content.ReadAsAsync<TokenAuth>().Result;
                Assert.AreEqual(response.StatusCode, HttpStatusCode.OK, "Status Authentification");

                var result = server.CreateRequest("/api/Account/Phone").And(x =>
                {
                    x.Content = new ObjectContent(typeof(PhoneModel), phoneModel, new JilFormatter());
                    x.Content.Headers.ContentType = new MediaTypeHeaderValue(GenericNames.APP_JSON);
                }).AddHeader("Authorization", new AuthenticationHeaderValue("Bearer", token.access_token).ToString()).PostAsync().Result;
                Assert.AreEqual(HttpStatusCode.OK, result.StatusCode, "Add Secondary Phone");

                result = server.CreateRequest("/api/Account").AddHeader("Authorization", new AuthenticationHeaderValue("Bearer", token.access_token).ToString()).GetAsync().Result;
                Assert.AreEqual(HttpStatusCode.OK, result.StatusCode, "Status Get Account");
                var msg = result.Content.ReadAsAsync<ExposeAccountModel>().Result;
                var SearchPhone = from phone in msg.SecondaryPhone where phone.Phone == phoneModel.Phone select phone;
                Assert.AreEqual(1, SearchPhone.Count(), "Count Secondary Phone");

                var phoneModelPut = Factory.Create(SearchPhone.FirstOrDefault());
                phoneModelPut.IsPrimary = false;
                phoneModelPut.Phone = "4545454545";
                result = server.CreateRequest(String.Format("/Api/Account/Phone/{0}", SearchPhone.FirstOrDefault().Id)).And(x =>
                {
                    x.Content = new ObjectContent(typeof(PhoneModel), phoneModelPut, new JilFormatter());
                    x.Content.Headers.ContentType = new MediaTypeHeaderValue(GenericNames.APP_JSON);
                }).AddHeader("Authorization", new AuthenticationHeaderValue("Bearer", token.access_token).ToString()).SendAsync("PUT").Result;
                Assert.AreEqual(HttpStatusCode.OK, result.StatusCode, "Status Put Secondary Phone");

                result = server.CreateRequest("/api/Account").AddHeader("Authorization", new AuthenticationHeaderValue("Bearer", token.access_token).ToString()).GetAsync().Result;
                Assert.AreEqual(HttpStatusCode.OK, result.StatusCode, "Status Get Account");
                msg = result.Content.ReadAsAsync<ExposeAccountModel>().Result;
                SearchPhone = from phone in msg.SecondaryPhone where phone.Phone == "4545454545" select phone;
                Assert.AreEqual(1, SearchPhone.Count(), "Count Secondary Phone Check");

                result = server.CreateRequest(string.Format("/api/Account/Phone/{0}", SearchPhone.FirstOrDefault().Id)).AddHeader("Authorization", new AuthenticationHeaderValue("Bearer", token.access_token).ToString()).SendAsync("DELETE").Result;
                Assert.AreEqual(HttpStatusCode.OK, result.StatusCode, "Status DELETE PHONE NUMBER");

                result = server.CreateRequest("/api/Account").AddHeader("Authorization", new AuthenticationHeaderValue("Bearer", token.access_token).ToString()).GetAsync().Result;
                Assert.AreEqual(HttpStatusCode.OK, result.StatusCode, "Status Get Account");
                msg = result.Content.ReadAsAsync<ExposeAccountModel>().Result;
                Assert.AreEqual(0, msg.SecondaryPhone.Count());
            }
        }
示例#26
0
 public PaymentTypeRepository(ManahostManagerDAL ctx) : base(ctx)
 {
 }
示例#27
0
 public void Init()
 {
     ctx  = EFContext.CreateContext();
     repo = new BillItemRepository(ctx);
 }
示例#28
0
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new FieldGroupRepository(ctx);
 }
示例#29
0
 public SatisfactionConfigRepository(ManahostManagerDAL ctx) : base(ctx)
 {
 }
示例#30
0
 public void Init()
 {
     ctx  = EFContext.CreateContext();
     repo = new PeriodRepository(ctx);
 }
示例#31
0
 public DocumentRepository(ManahostManagerDAL ctx) : base(ctx)
 {
 }
示例#32
0
 public SupplierRepository(ManahostManagerDAL ctx) : base(ctx)
 {
 }
示例#33
0
 public void Init()
 {
     ctx  = EFContext.CreateContext();
     repo = new SupplierRepository(ctx);
 }
        public void TestRefreshToken()
        {
            Database.SetInitializer(new ManahostManagerInitializer());
            using (ManahostManagerDAL prectx = new ManahostManagerDAL())
            {
                prectx.Database.Delete();
            }
            using (var server = TestServer.Create<WebApiApplication>())
            {
                HttpResponseMessage response = server.CreateRequest("/token").And((x) => x.Content = new StringContent(string.Format("grant_type=password&username={0}&password={1}&client_id=UNITTEST&client_secret=BLAHBLAHCAR", ControllerUtils.username, ControllerUtils.password), Encoding.UTF8, "application/x-www-form-urlencoded")).PostAsync().Result;
                TokenAuth token = response.Content.ReadAsAsync<TokenAuth>().Result;
                Assert.AreEqual(response.StatusCode, HttpStatusCode.OK, "Status Authentification");

                response = server.CreateRequest("/token").And((x) => x.Content = new StringContent(string.Format("grant_type=refresh_token&client_id=UNITTEST&client_secret=BLAHBLAHCAR&refresh_token={0}", token.refresh_token), Encoding.UTF8, "application/x-www-form-urlencoded")).PostAsync().Result;
                Assert.AreEqual(response.StatusCode, HttpStatusCode.OK, "Status RefreshToken");
                token = response.Content.ReadAsAsync<TokenAuth>().Result;

                response = server.CreateRequest("/api/Account").AddHeader("Authorization", new AuthenticationHeaderValue("Bearer", token.access_token).ToString()).GetAsync().Result;
                Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
                var ExposeModel = response.Content.ReadAsAsync<ExposeAccountModel>().Result;
            }
        }
示例#35
0
 public MealRepository(ManahostManagerDAL ctx) : base(ctx)
 {
 }
示例#36
0
 public void Init()
 {
     ctx  = EFContext.CreateContext();
     repo = new MealBookingRepository(ctx);
 }
示例#37
0
 public HomeRepository(ManahostManagerDAL ctx)
     : base(ctx, true)
 {
 }
示例#38
0
 public void Init()
 {
     ctx  = EFContext.CreateContext();
     repo = new PeopleCategoryRepository(ctx);
 }
示例#39
0
 public MailLogRepository(ManahostManagerDAL ctx) : base(ctx)
 {
 }
示例#40
0
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new RoomSupplementRepository(ctx);
 }
示例#41
0
 public void Init()
 {
     ctx  = EFContext.CreateContext();
     repo = new PricePerPersonRepository(ctx);
 }
示例#42
0
 public RoomSupplementRepository(ManahostManagerDAL ctx) : base(ctx)
 {
 }
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new MealCategoryRepository(ctx);
 }
示例#44
0
 public static async Task Seed(ManahostManagerDAL context, Client currentClient)
 {
     await context.SaveChangesAsync();
 }
示例#45
0
 public void Init()
 {
     ctx  = EFContext.CreateContext();
     repo = new PaymentTypeRepository(ctx);
 }
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new PricePerPersonRepository(ctx);
 }
示例#47
0
 public AdditionalRepositories(ManahostManagerDAL ctx)
 {
     PeopleRepo   = new PeopleRepository(ctx);
     HomeRepo     = new HomeRepository(ctx);
     DocumentRepo = new DocumentRepository(ctx);
 }
示例#48
0
 public BillRepository(ManahostManagerDAL dal) : base(dal)
 {
 }
示例#49
0
 public void Init()
 {
     ctx  = EFContext.CreateContext();
     repo = new MailConfigRepository(ctx);
 }
示例#50
0
 public void Init()
 {
     ctx  = EFContext.CreateContext();
     repo = new SatisfactionConfigRepository(ctx);
 }
示例#51
0
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new SupplierRepository(ctx);
 }
示例#52
0
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new DocumentRepository(ctx);
 }
示例#53
0
 public RoomCategoryRepository(ManahostManagerDAL ctx)
     : base(ctx)
 {
 }
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new RoomSupplementRepository(ctx);
 }
示例#55
0
 public void Init()
 {
     ctx    = EFContext.CreateContext();
     repo   = new AdditionalBookingRepository(ctx);
     entity = new AdditionalBooking()
     {
         BillItemCategory = new BillItemCategory()
         {
             DateModification = DateTime.Now,
             Home             = ctx.HomeSet.FirstOrDefault(x => x.Title == "LaCorderie"),
             Title            = "EFTest"
         },
         Booking = new Booking()
         {
             Comment            = "I am a comment",
             DateArrival        = DateTime.Now.AddYears(1),
             DateCreation       = DateTime.Now,
             DateDeparture      = DateTime.Now.AddYears(3),
             DateDesiredPayment = DateTime.Now.AddYears(3).AddMonths(1),
             DateModification   = DateTime.Now,
             DateValidation     = DateTime.Now.AddMonths(4),
             Home                 = ctx.HomeSet.FirstOrDefault(x => x.Title == "LaCorderie"),
             IsOnline             = false,
             IsSatisfactionSended = false,
             People               = new People()
             {
                 AcceptMailing = true,
                 Addr          = "4 place kleber",
                 City          = "Strasbourg",
                 Civility      = "Mr",
                 Comment       = "A mis le feu à la chambre",
                 Country       = "FRANCE",
                 DateBirth     = DateTime.Now,
                 DateCreation  = DateTime.Now,
                 Email         = "*****@*****.**",
                 Firstname     = "CHAABANE",
                 Home          = ctx.HomeSet.FirstOrDefault(x => x.Title == "LaCorderie"),
                 Lastname      = "Jalal",
                 Mark          = 0,
                 Phone1        = "0600000000",
                 Phone2        = null,
                 State         = null,
                 ZipCode       = "67000",
                 Hide          = false
             },
             TotalPeople = 4
         },
         DateModification = DateTime.Now,
         Home             = ctx.HomeSet.FirstOrDefault(x => x.Title == "LaCorderie"),
         PriceHT          = 999M,
         PriceTTC         = 999M,
         Tax = new Tax()
         {
             DateModification = DateTime.Now,
             Home             = ctx.HomeSet.FirstOrDefault(x => x.Title == "LaCorderie"),
             Price            = 50M,
             Title            = "EFTest",
             ValueType        = EValueType.PERCENT
         },
         Title = "EFTest"
     };
 }
示例#56
0
 public ProductRepository(ManahostManagerDAL ctx) : base(ctx)
 {
 }
        public void PutAccount()
        {
            Database.SetInitializer(new ManahostManagerInitializer());
            using (ManahostManagerDAL prectx = new ManahostManagerDAL())
            {
                prectx.Database.Delete();
            }
            var PutClientModel = new PutAccountModel()
            {
                Civility = "Mlle",
                Country = "UnderCity",
                FirstName = "Sylvanas",
                LastName = "Coursevent"
            };
            using (var server = TestServer.Create<WebApiApplication>())
            {
                HttpResponseMessage response = server.CreateRequest("/token").And((x) => x.Content = new StringContent(string.Format("grant_type=password&username={0}&password={1}&client_id=UNITTEST&client_secret=BLAHBLAHCAR", ControllerUtils.username, ControllerUtils.password), Encoding.UTF8, "application/x-www-form-urlencoded")).PostAsync().Result;
                TokenAuth token = response.Content.ReadAsAsync<TokenAuth>().Result;
                Assert.AreEqual(response.StatusCode, HttpStatusCode.OK, "Status Authentification");

                response = server.CreateRequest("/Api/Account").And(x =>
                {
                    x.Content = new ObjectContent(typeof(PutAccountModel), PutClientModel, new JilFormatter());
                    x.Content.Headers.ContentType = new MediaTypeHeaderValue(GenericNames.APP_JSON);
                }).AddHeader("Authorization", new AuthenticationHeaderValue("Bearer", token.access_token).ToString()).SendAsync("PUT").Result;
                Assert.AreEqual(HttpStatusCode.OK, response.StatusCode, "Status Code PUT Account");

                response = server.CreateRequest("/api/Account").AddHeader("Authorization", new AuthenticationHeaderValue("Bearer", token.access_token).ToString()).GetAsync().Result;
                Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
                var ExposeModel = response.Content.ReadAsAsync<ExposeAccountModel>().Result;
                Assert.AreEqual(PutClientModel.Civility, ExposeModel.Civility, "Check Civility");
                Assert.AreEqual(PutClientModel.Country, ExposeModel.Country, "Check Country");
                Assert.AreEqual(PutClientModel.FirstName, ExposeModel.FirstName, "Check FirstName");
                Assert.AreEqual(PutClientModel.LastName, ExposeModel.LastName, "Check LastName");
            }
        }
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new PeopleBookingRepository(ctx);
 }
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new KeyGeneratorRepository(ctx);
 }