public void Arrange() { _repo = new ClaimsRepo(); _nextClaim = new Claims(3, ClaimType.Theft, "Broken Window. TV was stolen.", 674.38d, new DateTime(2016, 12, 10), new DateTime(2017, 01, 02)); _anotherClaim = new Claims(4, ClaimType.Theft, "Broken Window. TV was stolen.", 674.38d, new DateTime(2016, 12, 10), new DateTime(2017, 01, 02)); _oneMoreClaim = new Claims(5, ClaimType.Theft, "Broken Window. TV was stolen.", 674.38d, new DateTime(2016, 12, 10), new DateTime(2017, 01, 02)); _repo.AddNewClaim(_nextClaim); _repo.AddNewClaim(_anotherClaim); _repo.AddNewClaim(_oneMoreClaim); }
//Add New Claim private void AddNewClaim() { Console.Clear(); Claims newClaim = new Claims(); //Claim ID Console.WriteLine("Enter the claim id:"); string claimIDAsString = Console.ReadLine(); newClaim.ClaimID = int.Parse(claimIDAsString); //Claim Type - ENUM Console.WriteLine("Select the claim type: \n" + "1. Car \n" + "2. Home \n" + "3. Theft"); string claimTypeAsString = Console.ReadLine(); switch (claimTypeAsString) { case "1": newClaim.ClaimType = ClaimType.Car; break; case "2": newClaim.ClaimType = ClaimType.Home; break; case "3": newClaim.ClaimType = ClaimType.Theft; break; } //Description Console.WriteLine("Enter description for claim:"); newClaim.Description = Console.ReadLine(); //Damage Amount Console.WriteLine("Amount of damage: "); string claimAmountAsString = Console.ReadLine(); newClaim.ClaimAmount = double.Parse(claimAmountAsString); //Date of Accident Console.WriteLine("Enter the date the accident occurred (YYYY,MM,DD):"); var incidentDate = Console.ReadLine(); newClaim.DateOfIncident = DateTime.Parse(incidentDate); //Date of Claim Console.WriteLine("Enter the date the claim was filed (YYYY,MM,DD)"); var claimDate = Console.ReadLine(); newClaim.DateOfClaim = DateTime.Parse(claimDate); _claimsRepo.AddNewClaim(newClaim); }
//3. New Claim private void NewClaim() { Console.Clear(); Claims newClaim = new Claims(); Console.WriteLine("Enter the Claim Type: \n" + "1. Car\n" + "2. Home\n" + "3. Theft\n"); string typeAsString = Console.ReadLine(); int typeAsInt = int.Parse(typeAsString); newClaim.TypeOfClaim = (ClaimType)typeAsInt; Console.WriteLine("Enter the new claim ID number:"); string itemNumber = Console.ReadLine(); newClaim.ClaimId = int.Parse(itemNumber); Console.WriteLine("Enter brief description of claim:"); newClaim.Description = Console.ReadLine(); Console.WriteLine("Enter amount of claim:"); string claimAmount = Console.ReadLine(); newClaim.ClaimAmount = double.Parse(claimAmount); Console.WriteLine("Enter the date the incident took place (yyyy/mm/dd):"); string incidentDate = Console.ReadLine(); newClaim.DateOfIncident = DateTime.Parse(incidentDate); Console.WriteLine("Enter the date that incident was reported to claims(yyyy/mm/dd):"); string claimDate = Console.ReadLine(); newClaim.DateOfClaim = DateTime.Parse(claimDate); //if the content was saved, say so //otherwise state it could not be saved. bool wasSaved = _claimsRepo.AddNewClaim(newClaim); if (wasSaved) { Console.WriteLine("Content successfuly updated!"); } else { Console.WriteLine("Could not update content."); } }
public void AddNewClaim_ShouldGetCorrectBoolean() { //Arrange Claims claim = new Claims(); ClaimsRepo repo = new ClaimsRepo(); //Act bool addClaim = repo.AddNewClaim(claim); //Assert Assert.IsTrue(addClaim); }
public void RemoveClaim_ShouldGetCorrectBoolean() { //Arrange Claims claim = new Claims(); ClaimsRepo repo = new ClaimsRepo(); repo.AddNewClaim(claim); //Don't Forget - Has To Have Something To Delete!!!!! //Act bool deleteClaim = repo.RemoveClaim(claim); //Assert Assert.IsTrue(deleteClaim); }
public void ViewClaims_ShouldReturnClaims() { //Arrange Claims claim = new Claims(); ClaimsRepo repo = new ClaimsRepo(); repo.AddNewClaim(claim); //Act Queue <Claims> claims = repo.ViewClaims(); bool queueHasClaims = claims.Contains(claim); //Assert Assert.IsTrue(queueHasClaims); }
public void Arrange() { Claims claimFour = new Claims(ClaimType.Theft, 104, "Gun Theft", 1000, new DateTime(2020, 11, 01), new DateTime(2020, 12, 02)); _repo.AddNewClaim(claimFour); }