public void Rent_Per_Family_GetCost_3rents() { float expectedCostResult = (float)(160 * (0.7)); RentPerWeek rent1 = new RentPerWeek(); RentPerWeek rent2 = new RentPerWeek(); RentPerDay rent3 = new RentPerDay(); rent3.DaysQuantity = 2; RentManager rentManager = new RentManager(); rentManager.Initialize(rent1); //Initialize Rent By Week cost rentManager.Initialize(rent2); //Initialize Rent By Week cost rentManager.Initialize(rent3); //Initialize Rent By Week cost FamilyRent rent = new FamilyRent(); rentManager.Initialize(rent); List <Rent> rents = new List <Rent> { rent1, rent2, rent3 }; rent.AddRents(rents); /*rent.AddRent(rent1); * rent.AddRent(rent2); * rent.AddRent(rent3);*/ float?totalCostResult = rentManager.FamilyRent_GetTotalAmount(rent); Assert.AreEqual(expectedCostResult, totalCostResult); }
public void Rent_Per_Family_GetCost_6rents() { RentPerHour rent1 = new RentPerHour(); RentPerHour rent2 = new RentPerHour(); RentManager rentManager = new RentManager(); rentManager.Initialize(rent1); //Initialize Rent rentManager.Initialize(rent2); //Initialize Rent FamilyRent rent = new FamilyRent(); rentManager.Initialize(rent); rent.AddRent(rent1); //Adding 6 rents rent.AddRent(rent2); rent.AddRent(rent1); rent.AddRent(rent2); rent.AddRent(rent1); rent.AddRent(rent2); try { float?totalCostResult = rentManager.FamilyRent_GetTotalAmount(rent); } catch (Exception ex) { Assert.AreEqual <string>(ex.Message, "Family Rental, need include from 3 to 5 Rentals. This Family Rental only have 6 rents."); } }
public void Rent_Per_Hour_GetCost_WhitoutInitialize() { RentPerHour rent = new RentPerHour(); RentManager rentManager = new RentManager(); //rentManager.Initialize(rent); //Whitout Initialize //rent.HoursQuantity = 3; //Whitout set any hours. float?totalCostResult = rentManager.GetTotalCostRent(rent); Assert.IsNull(totalCostResult); }
public HttpResponseMessage Delete(int RentIdParam) { bool Result = RentManager.DeleteRent(RentIdParam); HttpStatusCode responsCode = Result ? HttpStatusCode.OK : HttpStatusCode.BadRequest; return(new HttpResponseMessage(responsCode) { Content = new ObjectContent <bool>(Result, new JsonMediaTypeFormatter()) }); }
public HttpResponseMessage Get() { RentModel[] RentsArr = RentManager.GetAllRents(); if (RentsArr == null) { return(new HttpResponseMessage(HttpStatusCode.BadRequest)); } return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new ObjectContent <RentModel[]>(RentsArr, new JsonMediaTypeFormatter()) }); }
public HttpResponseMessage Get(string StringParam) { RentModel[] RentArr = RentManager.GetSpesificRent(StringParam); if (RentArr == null) { return(new HttpResponseMessage(HttpStatusCode.BadRequest)); } return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new ObjectContent <RentModel[]>(RentArr, new JsonMediaTypeFormatter()) }); }
public void Rent_Per_Week_GetCost_OneWeek() { float expectedCostResult = 60; RentPerWeek rent = new RentPerWeek(); RentManager rentManager = new RentManager(); rentManager.Initialize(rent); //Initialize Rent By Week cost //rent.WeeksQuantity = 3; //Whitout set any Weeks. float?totalCostResult = rentManager.GetTotalCostRent(rent); Assert.AreEqual(expectedCostResult, totalCostResult); }
public void Rent_Per_Week_GetCost_ManyWeeks() { float expectedCostResult = 120; RentPerWeek rent = new RentPerWeek(); RentManager rentManager = new RentManager(); rentManager.Initialize(rent); //Initialize Rent By Week cost rent.WeeksQuantity = 2; //Set rent on 2 weeks float?totalCostResult = rentManager.GetTotalCostRent(rent); Assert.AreEqual(expectedCostResult, totalCostResult); }
public void Rent_Per_Day_GetCost_OneDay() { float expectedCostResult = 20; RentPerDay rent = new RentPerDay(); RentManager rentManager = new RentManager(); rentManager.Initialize(rent); //Initialize Rent By Day cost //rent.DaysQuantity = 3; //Whitout set any days. float?totalCostResult = rentManager.GetTotalCostRent(rent); Assert.AreEqual(expectedCostResult, totalCostResult); }
public void Rent_Per_Day_GetCost_ManyDays() { float expectedCostResult = 80; RentPerDay rent = new RentPerDay(); RentManager rentManager = new RentManager(); rentManager.Initialize(rent); //Initialize Rent By Day cost rent.DaysQuantity = 4; //Set rent on 4 Days float?totalCostResult = rentManager.GetTotalCostRent(rent); Assert.AreEqual(expectedCostResult, totalCostResult); }
public void Rent_Per_Hour_GetCost_ManyHours() { float expectedCostResult = 15; RentPerHour rent = new RentPerHour(); RentManager rentManager = new RentManager(); rentManager.Initialize(rent); //Initialize Rent By Hour cost rent.HoursQuantity = 3; //Set rent on 3 hours float?totalCostResult = rentManager.GetTotalCostRent(rent); Assert.AreEqual(expectedCostResult, totalCostResult); }
public HttpResponseMessage Get(int RentIdParam) { RentModel SingleRent = RentManager.GetSpesificRent(RentIdParam); if (SingleRent == null) { return(new HttpResponseMessage(HttpStatusCode.BadRequest)); } return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new ObjectContent <RentModel>(SingleRent, new JsonMediaTypeFormatter()) }); }
public void Rent_Per_Hour_GetCost_OneHour() { float expectedCostResult = 5; RentPerHour rent = new RentPerHour(); RentManager rentManager = new RentManager(); rentManager.Initialize(rent); //Initialize Rent By Hour cost //rent.HoursQuantity = 3; //Whitout set any hours. float?totalCostResult = rentManager.GetTotalCostRent(rent); Assert.AreEqual(expectedCostResult, totalCostResult); }
public HttpResponseMessage Put(int RentIdParam, [FromBody] RentModel rentparam) { bool updateResult = false; if (ModelState.IsValid) { updateResult = RentManager.EditRent(RentIdParam, rentparam); } HttpStatusCode rsponseCode = (updateResult) ? HttpStatusCode.OK : HttpStatusCode.BadRequest; return(new HttpResponseMessage(rsponseCode) { Content = new ObjectContent <bool>(updateResult, new JsonMediaTypeFormatter()) }); }
public HttpResponseMessage Post([FromBody] RentModel value) { bool InsertResult = false; if (ModelState.IsValid) { InsertResult = RentManager.AddNewRent(value); } HttpStatusCode ResponsCode = InsertResult ? HttpStatusCode.Created : HttpStatusCode.BadRequest; return(new HttpResponseMessage(ResponsCode) { Content = new ObjectContent <bool>(InsertResult, new JsonMediaTypeFormatter()) }); }
private static void RentCarTest() { var rentManager = new RentManager(new EfRentDal()); var result = rentManager.Add(new Rent { CarId = 1, CustomerId = 1, RentDate = DateTime.Now, ReturnDate = null }); System.Console.WriteLine(result.Message); //foreach (var rent in rentManager.GetAll().Data) //{ // System.Console.WriteLine(rent.CarId); //} } //sıkıntı var
static void Main(string[] args) { //BusinessManager businessManager = new BusinessManager(new EfCarDal()); //businessManager.Update(new Car { Id = 5, Name = "cba", BrandId = 1, ColorId = 1, DailyPrice = 00 }); //Console.WriteLine("GetALL"); //Print(businessManager); //Car car = NewCar(businessManager); //businessManager.Add(car); //Console.WriteLine("------Added-------"); //Print(businessManager); //businessManager.Delete(car); //Console.WriteLine("-----Deleted-----"); //Print(businessManager); //Console.WriteLine("-----Updated-----"); //businessManager.Update(new Car { Id = 5, Name = "xxx", BrandId = 1, ColorId = 1, DailyPrice = 00 }); //Print(businessManager); RentManager rentManager = new RentManager(new EfRentDal()); rentManager.Add(new Rental { CarId = 1, CustomerId = 1 }); rentManager.Add(new Rental { CarId = 2, CustomerId = 1 }); var result = rentManager.GetAll().Data; foreach (var item in result) { Console.WriteLine("{2}, {1}, {0}, {3}, {4}", item.CarId, item.CustomerId, item.Id, item.RentDate, item.ReturnDate); } }
private static void RentDetailsTest() { RentManager rentManager = new RentManager(new EfRentDal()); var result = rentManager.GetRentDetails(); foreach (var rent in result.Data) { Console.WriteLine( rent.RentId + "/" + rent.CarDescription + "/" + rent.CustomerName + "/" + rent.FirstName + "/" + rent.LastName + "/" + rent.RentDate + "/" + rent.ReturnDate); } }
public void Rent_Per_Family_GetCost_5rents() { float expectedCostResult = (float)((20 + 15 + 20 + 5 + 5) * (0.7)); RentPerHour rent1 = new RentPerHour(); RentPerHour rent2 = new RentPerHour(); RentPerDay rent3 = new RentPerDay(); RentPerHour rent4 = new RentPerHour(); RentPerHour rent5 = new RentPerHour(); rent1.HoursQuantity = 4; rent2.HoursQuantity = 3; RentManager rentManager = new RentManager(); rentManager.Initialize(rent1); //Initialize Rent rentManager.Initialize(rent2); //Initialize Rent rentManager.Initialize(rent3); //Initialize Rent rentManager.Initialize(rent4); //Initialize Rent rentManager.Initialize(rent5); //Initialize Rent FamilyRent rent = new FamilyRent(); rentManager.Initialize(rent); List <Rent> rents = new List <Rent> { rent1, rent2, rent3 }; rent.AddRents(rents); rent.AddRent(rent4); rent.AddRent(rent5); float?totalCostResult = rentManager.FamilyRent_GetTotalAmount(rent); Assert.AreEqual(expectedCostResult, totalCostResult); }
public HomePage() { Rooms = new List <Rent>(); this.InitializeComponent(); Rooms = RentManager.getRooms(); }
private void MenuFlyoutItem_Click(object sender, RoutedEventArgs e) { locationButton.Content = "Kathmandu"; RentManager.Getroom("Flat", locationButton.Content.ToString(), PriceButton.Content.ToString(), Rooms); }
public BuildingPage() { Rooms = new ObservableCollection <Rent>(); this.InitializeComponent(); RentManager.Getroom("House", Rooms); }
private void MenuFlyoutItem_Click_3(object sender, RoutedEventArgs e) { PriceButton.Content = "2000-3000"; RentManager.Getroom("House", locationButton.Content.ToString(), PriceButton.Content.ToString(), Rooms); }
public RoomPage() { Rooms = new ObservableCollection <Rent>(); this.InitializeComponent(); RentManager.Getroom("Room", Rooms); }
private void MenuFlyoutItem_Click_4(object sender, RoutedEventArgs e) { locationButton.Content = "Bhaktapur"; RentManager.Getroom("Room", locationButton.Content.ToString(), PriceButton.Content.ToString(), Rooms); }
public void CreateRentManager(string firstName, string lastName, string userId) { var rentManager = new RentManager { UserFirstName = firstName, UserLastName = lastName, ApplicationUserId = userId }; db.RentManagers.Add(rentManager); db.SaveChanges(); }