private void AddToClaim() //add a claim { Console.Clear(); //new claim content ClaimProperties content = new ClaimProperties(); //user input //claim ID Console.WriteLine("Please enter the claim ID."); string contentClaimID = Console.ReadLine(); content.ClaimID = Int32.Parse(contentClaimID); //claim type Console.WriteLine($"Please enter the claim type. Press 1 for Car, 2 for Home, 3 for Theft."); string contentType = Console.ReadLine(); int typeID = int.Parse(contentType); content.TypeOfClaim = (ClaimType)typeID; //claim description Console.WriteLine($"Please enter the description."); string contentDescription = Console.ReadLine(); content.Description = contentDescription; //claim amount Console.WriteLine($"Please enter the claim amount."); string contentClaimAmount = Console.ReadLine(); content.ClaimAmount = int.Parse(contentClaimAmount); //date of incident Console.WriteLine($"Please enter the date of incident. (yyyy, mm, dd)"); DateTime DateOfIncident = Convert.ToDateTime(Console.ReadLine()); content.DateOfIncident = DateOfIncident; //date of claim Console.WriteLine($"Please enter the date of claim.(yyyy, mm, dd)"); DateTime DateOfClaim = Convert.ToDateTime(Console.ReadLine()); content.DateOfClaim = DateOfClaim; //add item if (_claimMethods.AddContentToRepo(content)) { Console.WriteLine($"Item(s) added."); } else { Console.WriteLine("Added item(s) failed."); } //a new content with properties filled out by user //pass that to the add method in our methods Console.WriteLine("Press any key to continue...."); Console.ReadKey(); }
public void AddToClaimMethods_ShouldGetCorrectBool() { //arrange ClaimMethods repo = new ClaimMethods(); ClaimProperties _claimObject = new ClaimProperties(1, ClaimType.Car, "Car Accident on 465.", 400.00, new DateTime(2018, 04, 25), new DateTime(2018, 04, 27)); //act bool addResult = repo.AddContentToRepo(_claimObject); //assert Assert.IsTrue(addResult); }
public void GetClaims_ShouldReturnCorrectClaims() { //arrange ClaimMethods repo = new ClaimMethods(); ClaimProperties _claimObject = new ClaimProperties(1, ClaimType.Car, "Car Accident on 465.", 400.00, new DateTime(2018, 04, 25), new DateTime(2018, 04, 27)); repo.AddContentToRepo(_claimObject); ClaimProperties _claimObject2 = new ClaimProperties(2, ClaimType.Home, "House fire in kitchen.", 4000.00, new DateTime(2018, 04, 11), new DateTime(2018, 04, 12)); repo.AddContentToRepo(_claimObject2); ClaimProperties _claimObject3 = new ClaimProperties(3, ClaimType.Theft, "Stolen pancakes.", 4.00, new DateTime(2018, 04, 27), new DateTime(2018, 06, 01)); repo.AddContentToRepo(_claimObject3); //act List <ClaimProperties> listOfClaims = repo.GetClaims(); //assert bool repoHasContent = listOfClaims.Contains(_claimObject); Assert.IsTrue(repoHasContent); }
public void GetNextClaim_ShouldGetCorrectBool() { //arrange ClaimMethods repo = new ClaimMethods(); ClaimProperties _claimObject = new ClaimProperties(1, ClaimType.Car, "Car Accident on 465.", 400.00, new DateTime(2018, 04, 25), new DateTime(2018, 04, 27)); repo.AddContentToRepo(_claimObject); //act int getNext = repo.ClaimQueueUp(); //assert Assert.AreEqual(1, getNext); }