public void AddClaim() { var newClaim = new Claim(); // get claim ID Console.WriteLine("Enter Claim ID:"); newClaim.ClaimID = Int32.Parse(Console.ReadLine()); // Get claim type Console.WriteLine("Enter the type of claim (1. Car, 2. Home, 3. Theft)"); string claimTypeString = Console.ReadLine(); bool active = true; while (active) { switch (claimTypeString.ToLower()) { case "1": { newClaim.Type = Claim.ClaimType.Car; active = false; break; } case "2": { newClaim.Type = Claim.ClaimType.Home; active = false; break; } case "3": { newClaim.Type = Claim.ClaimType.Theft; active = false; break; } default: { Console.WriteLine("Enter the valid type of claim (1.Car, 2.Home, 3.Theft)"); break; } } } // Get claim Description Console.WriteLine("Enter claim description:"); newClaim.Description = Console.ReadLine(); //get ammount - write helper newClaim.ClaimAmount = InputDoubleHelper("Enter the claim amount:", "Enter claim ammount in the format #.## without $ sign."); // get Date of Incident newClaim.DateOfIncident = InputDateHelper("Enter the incident date (MM/DD/YYYY):", "Enter incident date in the format MM/DD/YYYY."); // get Date of Claim newClaim.DateOfClaim = InputDateHelper("Enter the claim date (MM/DD/YYYY):", "Enter claim date in the format MM/DD/YYYY."); // get IsValid - this will be confirmed or overwritten in the add method based on business rules newClaim.IsValid = true; // Add to the queue queueOfClaims.AddToQueue(newClaim); }
public void TestAdd() { // arrange - IsValid set to false. should be changed within add method due to business rules Claim expectedClaim = new Claim(1, Claim.ClaimType.Car, "Vehicle Accident", 1500, new DateTime(2020, 03, 03), new DateTime(2020, 04, 01), true); bool result = false; // Act testClaimRepo.AddToQueue(new Claim(1, Claim.ClaimType.Car, "Vehicle Accident", 1500, new DateTime(2020, 03, 03), new DateTime(2020, 04, 01), true)); var resultClaim = testClaimRepo.GetCurrentClaim(); if (resultClaim.Description == expectedClaim.Description && resultClaim.ClaimID == expectedClaim.ClaimID && resultClaim.ClaimAmount == expectedClaim.ClaimAmount && resultClaim.DateOfClaim == expectedClaim.DateOfClaim && resultClaim.DateOfIncident == expectedClaim.DateOfIncident && resultClaim.IsValid == expectedClaim.IsValid && resultClaim.Type == expectedClaim.Type) { result = true; } // Assert Assert.IsTrue(result); //????????? This fails when I compare the entire claim //Assert.AreEqual(expectedClaim, resultClaim); }