private void CreateInitialQueue() { Claim a = new Claim(1, ClaimType.Car, "A very good car", 325.23, DateTime.Now, DateTime.Now, true); Claim b = new Claim(2, ClaimType.Home, "home insurance", 1325.23, DateTime.Now, DateTime.Now, true); Claim c = new Claim(3, ClaimType.Theft, "theft insurace is good", 11325.23, DateTime.Now, DateTime.Now, false); claimsRepo.AddClaimToQueue(a); claimsRepo.AddClaimToQueue(b); claimsRepo.AddClaimToQueue(c); }
private void SeedClaimsQueue() { Claims stolenYappyDog = new Claims(1, ClaimType.Theft, "dog stolen from backyard", 1000.00, new DateTime(2021, 1, 21), new DateTime(2021, 2, 3)); Claims beaterGotBeat = new Claims(2, ClaimType.Car, "beater car ran over nail", 500.00, new DateTime(2020, 3, 5), new DateTime(2020, 7, 1)); Claims wallpaperExplosion = new Claims(3, ClaimType.Home, "wallpaper, glue, walls... there was an explosion", 5000.00, new DateTime(1 / 27 / 21), new DateTime(2 / 3 / 21)); _claimsRepo.AddClaimToQueue(stolenYappyDog); _claimsRepo.AddClaimToQueue(beaterGotBeat); _claimsRepo.AddClaimToQueue(wallpaperExplosion); }
public void AddClaimToQueue_ShouldAddClaim() { Claims newClaim = new Claims(1, ClaimType.Car, "in auto accident", 32.01, new DateTime(2009, 2, 1), new DateTime(2009, 9, 5)); ClaimsRepo _claimsTest = new ClaimsRepo(); bool addResult = _claimsTest.AddClaimToQueue(newClaim); Assert.IsTrue(addResult); }
public void TestAddToQueue() { ClaimsRepo claimsRepo = new ClaimsRepo(); Claim testClaim = new Claim(); Assert.AreEqual(0, claimsRepo.GetClaimQueue().Count); claimsRepo.AddClaimToQueue(testClaim); Assert.AreEqual(1, claimsRepo.GetClaimQueue().Count); }
public void DisplayNextClaim_ShouldDisplayNextClaim() { Claims content = new Claims(); ClaimsRepo repo = new ClaimsRepo(); repo.AddClaimToQueue(content); Queue <Claims> getTheClaimsCollection = repo.GetEntireQueue(); Claims getTheNextClaim = repo.DisplayNextClaim(); Assert.AreEqual(content, getTheNextClaim); }
public void GetEntireQueue_ShouldGetAllClaims() { Claims content = new Claims(); ClaimsRepo repo = new ClaimsRepo(); repo.AddClaimToQueue(content); Queue <Claims> allClaims = repo.GetEntireQueue(); bool directoryHasContent = allClaims.Contains(content); Assert.IsTrue(directoryHasContent); }
public void DeleteClaim_ShouldDeleteClaim() { Claims content = new Claims(); ClaimsRepo repo = new ClaimsRepo(); repo.AddClaimToQueue(content); Queue <Claims> getTheClaimsCollection = repo.GetEntireQueue(); repo.DeleteClaim(); bool directoryHasContent = getTheClaimsCollection.Contains(content); Assert.IsFalse(directoryHasContent); }
public void TestProcessClaim() { ClaimsRepo claimsRepo = new ClaimsRepo(); DateTime dateOfIncident01 = new DateTime(2018, 04, 25); DateTime dateOfClaim01 = new DateTime(2018, 04, 27); Claim testClaim01 = new Claim(1, ClaimType.Car, "Car accident on 465.", 400.00m, dateOfIncident01, dateOfClaim01, true); claimsRepo.AddClaimToQueue(testClaim01); // ensuring claim was added to queue before testing dequeue Assert.AreEqual(1, claimsRepo.GetClaimQueue().Count); // testing that dequeue removed the one added claim from queue claimsRepo.ProcessClaim(); Assert.AreEqual(0, claimsRepo.GetClaimQueue().Count); }
//private void UpdateClaim() // this is a lot of UI to write I may not have time to do this esp when I don't think it's needed as per the prompt //{ //} private void CreateClaim() { Console.Clear(); Claim newClaim = new Claim(); bool hasValidClaimID = false; while (hasValidClaimID == false) { Console.WriteLine("Enter the claim number for this incident:"); string newClaimNumAsString = Console.ReadLine(); try { newClaim.ClaimID = int.Parse(newClaimNumAsString); hasValidClaimID = true; } catch (Exception ex) { Console.WriteLine($"{ex.Message} Please enter as a numeric number.\n" + "Press enter to try again. . ."); Console.ReadLine(); } } Console.WriteLine("\nEnter the Type of incident by entering the corrisponding number:\n" + "1. Car\n" + "2. Home\n" + "3. Theft"); string claimTypeAsString = Console.ReadLine(); int claimTypeAsInt = int.Parse(claimTypeAsString); newClaim.TypeOfClaim = (ClaimType)claimTypeAsInt; Console.WriteLine("\nEnter the decription of the incident:\n"); newClaim.Description = Console.ReadLine(); bool hasVaildClaimAmountNumber = false; while (hasVaildClaimAmountNumber == false) { Console.WriteLine("\nEnter the claim amount (including cents):\n" + "Example format 1234.00\n"); string newClaimAmountString = Console.ReadLine(); try { newClaim.ClaimAmount = decimal.Parse(newClaimAmountString, System.Globalization.NumberStyles.AllowCurrencySymbol | System.Globalization.NumberStyles.Number); hasVaildClaimAmountNumber = true; } catch (Exception ex) { Console.WriteLine($"{ex.Message} please enter as a numeric number.\n" + "Example: 12.34 or $12.34\n" + "Press enter to try again. . ."); Console.ReadLine(); } } Console.WriteLine("\nEnter the 4 digit YEAR, 2 digit Month, 2 digit DAY the Incident took place:\n"); string newClaimDateIncidentString = Console.ReadLine(); DateTime newClaimIncidentDate = DateTime.Parse(newClaimDateIncidentString); newClaim.DateOfIncident = newClaimIncidentDate; Console.WriteLine("\nEnter the 4 digit YEAR, 2 digit Month, 2 digit DAY the Claim was made:\n"); string newClaimDateMadeString = Console.ReadLine(); DateTime newClaimMadeDate = DateTime.Parse(newClaimDateMadeString); newClaim.DateOfClaim = newClaimMadeDate; int isValid = DateTime.Compare(newClaimMadeDate, newClaimIncidentDate); if (isValid <= 30) { newClaim.IsValid = true; } else { newClaim.IsValid = false; } //Console.WriteLine("\nWas the Claim made within 30 Days of the Incident? (y/n)"); // would like to make with automatic with a calculation ^^ see above //string isClaimValidString = Console.ReadLine().ToLower(); //if (isClaimValidString == "y") //{ // newClaim.IsValid = true; //} //else //{ // newClaim.IsValid = false; //} _claimsQueue.AddClaimToQueue(newClaim); }