public void Arrange() { _repository = new ClaimRepository(); _content = new ClaimContent(3, ClaimType.Car, "Blown tire on interstate.", 500.00, new DateTime(2021, 1, 1), new DateTime(2021, 2, 1)); _repository.AddClaimToQueue(_content); }
public void TestAll() { ClaimContent claim1 = new ClaimContent(1, "House", "Tree Fell on Roof", 500.00d, new DateTime(2019, 01, 22), new DateTime(2019, 01, 24), true); _claimRepo.AddToQueue(claim1); ClaimContent claim2 = new ClaimContent(2, "Car", "Car Accident on I-69", 250.00d, new DateTime(2019, 02, 23), new DateTime(2019, 03, 01), true); _claimRepo.AddToQueue(claim2); ClaimContent claim3 = new ClaimContent(3, "Theft", "Stolen Pancakes", 4.00d, new DateTime(2019, 03, 20), new DateTime(2019, 03, 22), false); _claimRepo.AddToQueue(claim3); //bool properlyAdded = _claimRepo.HasContent(); //Assert.IsTrue(properlyAdded); //Console.WriteLine($"{properlyAdded}"); Console.WriteLine($"{_claimRepo.ViewNextClaim()} {_claimRepo.GetClaimQueue()}"); _claimRepo.DealWithClaim(); Console.WriteLine($"{_claimRepo.ViewNextClaim()}"); _claimRepo.GetClaimQueue(); bool hasContent = _claimRepo.HasContent(); Assert.IsTrue(hasContent); int newClaimNum = _claimRepo.GetClaimNumber(); Assert.AreEqual(4, newClaimNum); }
public void ProcessNextClaim() { Console.Clear(); Queue <ClaimContent> listOfClaims = _contentRepo._claimsQueue; ClaimContent firstClaim = listOfClaims.First <ClaimContent>(); Console.WriteLine($"ClaimID: {firstClaim.ClaimID} \n" + $"Type: {firstClaim.ClaimType} \n" + $"Description: {firstClaim.Description} \n" + $"Amount: ${firstClaim.ClaimAmount} \n" + $"DateOfAccident: {firstClaim.DateOfIncident} \n" + $"DateOfClaim: {firstClaim.DateOfClaim} \n" + $"IsValid: {firstClaim.IsValid} "); Console.WriteLine("Do you want to deal with this claim now (y/n)?"); string userInput = Console.ReadLine().ToLower(); switch (userInput) { case "y": Console.Clear(); listOfClaims.Dequeue(); Console.WriteLine("Claim processed"); Console.ReadLine(); break; case "n": Menu(); break; } }
public void Arrange() { _repo = new ClaimContentRepository(); _content = new ClaimContent(7, "car", "fender bender", new DateTime(1997 / 5 / 30), new DateTime(1997 / 6 / 10), 560.56, true); _repo.AddContentToQueue(_content); }
public void DefaultValues() { _repo = new ClaimRepo(); _content = new ClaimContent(1, TypesOfClaims.Car, "Crash", 4999, new DateTime(2020, 12, 9), new DateTime(2020, 12, 10), true); _repo.AddClaim(_content); }
public void EnterNewClaim() { Console.WriteLine("Enter claim id: "); string claimIDString = Console.ReadLine(); int claimID = int.Parse(claimIDString); Console.WriteLine("Enter claim type: \n" + "1. Car\n" + "2. Home\n" + "3. Theft\n"); string typeAsString = Console.ReadLine(); int typeAsInt = int.Parse(typeAsString); ClaimType type = (ClaimType)typeAsInt; Console.WriteLine("Enter claim amount: "); string claimAmountString = Console.ReadLine(); decimal claimAmount = decimal.Parse(claimAmountString); Console.WriteLine("Enter date of incident: (Example: 9/8/2009) "); string dateOfIncidentString = Console.ReadLine(); DateTime dateOfIncident = DateTime.Parse(dateOfIncidentString); Console.WriteLine("Enter date of claim: (Example: 9/8/2009) "); string dateOfClaimString = Console.ReadLine(); DateTime dateOfClaim = DateTime.Parse(dateOfClaimString); ClaimContent content = new ClaimContent(claimID, type, claimAmount, dateOfIncident, dateOfClaim); _claimRepo.AddToList(content); }
private void EnterANewClaim() { Console.WriteLine("Please enter a Claim ID"); string claimIDAsString = Console.ReadLine(); int claimID = int.Parse(claimIDAsString); Console.WriteLine("Please select a Claim Type\n" + "1 Car\n" + "2 Home\n" + "3 Theft\n" + "4 Exit"); string input = Console.ReadLine(); ClaimType typeofclaim = (ClaimType)int.Parse(input); Console.WriteLine("Please enter a description of this claim"); string description = Console.ReadLine(); Console.WriteLine("Please enter a claim amount"); string claimAmountAsString = Console.ReadLine(); decimal claimAmount = decimal.Parse(claimAmountAsString); Console.WriteLine("Please enter the date of the incident(yyyy/mm/dd"); DateTime dateOfIncident = DateTime.Parse(Console.ReadLine()); Console.WriteLine("Please enter the date of the claim (yyyy/mm/dd"); DateTime dateOfClaim = DateTime.Parse(Console.ReadLine()); ClaimContent newClaimContent = new ClaimContent(typeofclaim, claimID, description, claimAmount, dateOfIncident, dateOfClaim); _queueRepo.AddContentToQueue(newClaimContent); }
public void TestGetClaimsQueue() { repoWindow.loadQueue(); Queue <ClaimContent> tempVar = new Queue <ClaimContent>(); //tempVar hold the data from GetClaimsQueue tempVar = repoWindow.GetClaimsQueue(); //building out control data Queue <ClaimContent> controlData = new Queue <ClaimContent>(); ClaimContent claim1 = new ClaimContent("1", (ClaimType)1, "Car accident on 465.", Decimal.Parse("400.00"), DateTime.Parse("2018-04-25"), DateTime.Parse("2018-04-27"), true); ClaimContent claim2 = new ClaimContent("2", (ClaimType)2, "House fire in kitchen.", Decimal.Parse("4000.00"), DateTime.Parse(" 2018-04-11"), DateTime.Parse("2018-04-12"), true); ClaimContent claim3 = new ClaimContent("3", (ClaimType)3, "Stolen pancakes.", decimal.Parse("4.00"), DateTime.Parse("2018-04-27"), DateTime.Parse("2018-06-01"), false); controlData.Enqueue(claim1); controlData.Enqueue(claim2); controlData.Enqueue(claim3); //Because these are in queues comparing them would cause a dequeue //and loss of data to testing method - so we compare them in arrays ClaimContent[] tempArray = new ClaimContent[tempVar.Count]; tempVar.CopyTo(tempArray, 0); ClaimContent[] controlArray = new ClaimContent[controlData.Count]; controlData.CopyTo(controlArray, 0); //comparing the 2 arrays Assert.AreEqual(controlArray[0].Description, tempArray[0].Description); //dont need arrays here }
public void TakeCareOfClaim() { Queue <ClaimContent> contentQueue = _claimRepo.GetContentQueue(); ClaimContent nextClaim = contentQueue.Peek(); Console.WriteLine("Would you like to take care of this claim?"); Console.WriteLine($"\nClaim ID: {nextClaim.ClaimID}\n" + $"Claim Type: {nextClaim.Type}\n" + $"Claim Amount: {nextClaim.ClaimAmount}\n" + $"Date of Incident: {nextClaim.DateOfIncident}\n" + $"Date of Claim: {nextClaim.DateOfClaim}\n" + $"Is it Valid: {nextClaim.IsValid}\n"); Console.WriteLine("Y/N"); string response = Console.ReadLine(); response.ToUpper(); switch (response) { case "Y": _claimRepo.RemoveFirstItemFromQueue(); Console.WriteLine("Item has been removed."); Console.WriteLine("Please enter any key to continue... "); Console.ReadKey(); break; case "N": break; } }
public void IsValidClaimTest() { ClaimContent claimOne = new ClaimContent(1, ClaimType.Car, "Car accident on 465", 400.00m, new DateTime(2018, 04, 25), new DateTime(2018, 04, 27), true); ClaimContent claimTwo = new ClaimContent(2, ClaimType.Home, "House fire in kitchen", 4000.00m, new DateTime(2018, 04, 11), new DateTime(2018, 04, 18), true); ClaimContent claimThree = new ClaimContent(3, ClaimType.Theft, "Stolen pancakes", 1000.00m, new DateTime(2018, 04, 27), new DateTime(2018, 06, 01), false); _repoTest.IsValid(claimOne); bool actual = _repoTest.IsValid(claimOne); bool expected = true; Assert.AreEqual(expected, actual); _repoTest.IsValid(claimTwo); bool actualTwo = _repoTest.IsValid(claimTwo); bool expectTwo = true; Assert.AreEqual(expectTwo, actualTwo); _repoTest.IsValid(claimThree); bool actualThree = _repoTest.IsValid(claimThree); bool expectthree = false; Assert.AreEqual(expectthree, actualThree); }
// Review Claim private void ReviewClaim() { Console.Clear(); ClaimContent nextClaim = _claimsRepo.HandleNextClaim(); Console.WriteLine($"ClaimID: {nextClaim.ClaimID}\n" + $"Type: {nextClaim.TypeOfClaim}\n" + $"Description: {nextClaim.Description}\n" + $"Amount: {nextClaim.ClaimAmount}\n" + $"DateOfAccedent: {nextClaim.DateOfIncident}\n" + $"DateOfClaim: {nextClaim.DateOfClaim}\n" + $"IsValid: {nextClaim.IsValid}"); Console.WriteLine("Would you like to handle this claim? (Y/N)"); string handleClaim = Console.ReadLine().ToLower(); if (handleClaim == "y") { _claimsRepo.DequeueClaim(); Console.WriteLine("The claim was successfully proccesed. Press any key to go back to the menu."); Console.ReadKey(); Console.Clear(); Menu(); } else { Console.WriteLine("Press any key to go back to the main menu."); Console.ReadKey(); Console.Clear(); Menu(); } }
private void DisplayContentByNumber() { Console.Clear(); Console.WriteLine("Enter a claim you would like to display"); int claimId = int.Parse(Console.ReadLine()); ClaimContent content = _contentRepo.GetContentByNumber(claimId); if (content != null) { Console.WriteLine($"Claim ID: {content.ClaimId}\n" + $"Claim Type: {content.ClaimType}\n" + $"Description: {content.Description}\n" + $"Date of incident: {content.DateOfIncident}\n" + $"Date of claim: {content.DateOfClaim}\n" + $"Claim Amount: {content.ClaimAmount}\n" + $"Valid: {content.Valid}"); } else { Console.WriteLine("no claim by that number"); } }
public void ClaimContentObject() { ClaimContent contentOne = new ClaimContent(); contentOne.ClaimAmount = 200m; decimal expected = 200m; Assert.AreEqual(expected, contentOne.ClaimAmount); ClaimContent content = new ClaimContent(1, ClaimType.Car, 300m, DateTime.Today, DateTime.Today); int expectedID = 1; ClaimType expectedType = ClaimType.Car; decimal expectedClaimAmount = 300m; DateTime expectedDateOfIncident = DateTime.Today; DateTime expectedDateOfClaim = DateTime.Today; bool expectedIsValid = true; Assert.AreEqual(expectedID, content.ClaimID); Assert.AreEqual(expectedType, content.Type); Assert.AreEqual(expectedClaimAmount, content.ClaimAmount); Assert.AreEqual(expectedDateOfIncident, content.DateOfIncident); Assert.AreEqual(expectedDateOfClaim, content.DateOfClaim); Assert.AreEqual(expectedIsValid, content.IsValid); }
public void AddClaim_ShouldGetNotNull() { ClaimContent torres = new ClaimContent(1, TypesOfClaims.Car, "Car Accident on 465.", 400, new DateTime(2018, 4, 25), new DateTime(2018, 4, 27), true); _repo.AddClaim(torres); Assert.IsNotNull(torres); }
public void UpdateExistingContent_ShouldMatchGivenBool(int originalNumber, bool shouldUpdate) { ClaimContent newContent = new ClaimContent(7, "car", "fender bender", new DateTime(1997 / 05 / 30), new DateTime(1997 / 06 / 10), 560.56, true); bool updateResult = _repo.UpdateExistingContent(originalNumber, newContent); Assert.AreEqual(shouldUpdate, updateResult); }
public void AddClaimToQueueTest() { ClaimContent claim = new ClaimContent(); ClaimRepository repository = new ClaimRepository(); bool addClaim = repository.AddClaimToQueue(claim); Assert.IsTrue(addClaim); }
public void TestDisplayClaim() { repoWindow.loadQueue(); ClaimContent tempVar = repoWindow.DisplayClaim(); ClaimContent controlData = new ClaimContent("1", (ClaimType)1, "Car accident on 465.", Decimal.Parse("400.00"), DateTime.Parse("2018-04-25"), DateTime.Parse("2018-04-27"), true); Assert.AreEqual(controlData.Description, tempVar.Description); }
public void RemoveClaimFromQueueTest() { ClaimContent claim = _repository.GetClaimByID(3); bool removeResult = _repository.RemoveClaimFromQueue(claim); Assert.IsTrue(removeResult); }
public void MUpdateExistingClaimTest() { ClaimContent newClaim = new ClaimContent(2, ClaimType.Home, "Blown tire on interstate.", 500.00, new DateTime(2021, 1, 1), new DateTime(2021, 2, 1)); bool updateResult = _repository.UpdateExistingClaim(3, newClaim); Assert.IsTrue(updateResult); }
public void UpdateExistingContent_ShouldReturnTrue() { ClaimContent newContent = new ClaimContent(7, "car", "fender bender", new DateTime(1997 - 5 - 30), new DateTime(1997 - 6 - 10), 560.56, true); bool updateResult = _repo.UpdateExistingContent(1, newContent); Assert.IsTrue(updateResult); }
public void Test_CreateNewClaim() { ClaimContent testClaim = new ClaimContent(); bool expected = _testRepo.CreateNewClaim(testClaim); Assert.IsTrue(expected); }
private void AddNewClaim() { Console.Clear(); ClaimContent newClaim = new ClaimContent(); Console.WriteLine("Enter Claim ID:"); string idOfClaim = Console.ReadLine(); int newIDOfClaim = int.Parse(idOfClaim); newClaim.ClaimID = newIDOfClaim; Console.WriteLine("Enter claim type: (Enter NUMBER)\n" + "1. Car\n" + "2. Home\n" + "3. Theft"); string typeOfClaim = Console.ReadLine(); int intOfClaim = int.Parse(typeOfClaim); newClaim.ClaimType = (TypesOfClaims)intOfClaim; Console.WriteLine("Enter a claim description: "); string claimDesc = Console.ReadLine(); newClaim.Description = claimDesc; Console.WriteLine("Amount of Damage: "); string claimCost = Console.ReadLine(); double costAsDouble = double.Parse(claimCost); newClaim.ClaimAmount = costAsDouble; Console.WriteLine("Date of Accident:"); string dateOfAcc = Console.ReadLine(); DateTime dateAsDate = DateTime.Parse(dateOfAcc); newClaim.DateOfIncident = dateAsDate; Console.WriteLine("Date of Claim:"); string dateOfClaim = Console.ReadLine(); DateTime claimDateAsDate = DateTime.Parse(dateOfClaim); newClaim.DateOfClaim = claimDateAsDate; Console.WriteLine("Is this claim valid? (y/n)"); string validate = Console.ReadLine().Trim().ToLower(); if (validate == "y") { newClaim.IsValid = true; } else { newClaim.IsValid = false; } _claimRepo.AddClaim(newClaim); }
private void seedContentList() { ClaimContent numberOne = new ClaimContent(1, "car", "broken tire", new DateTime(2006 / 10 / 25), new DateTime(2006 / 12 / 25), 600.10, false); ClaimContent numberTwo = new ClaimContent(2, "car", "broken tire", new DateTime(2006 / 10 / 25), new DateTime(2006 / 12 / 25), 600.10, false); ClaimContent numberThree = new ClaimContent(3, "car", "broken tire", new DateTime(2006 / 10 / 25), new DateTime(2006 / 12 / 25), 600.10, false); _contentRepo.AddContentToQueue(numberOne); _contentRepo.AddContentToQueue(numberTwo); _contentRepo.AddContentToQueue(numberThree); }
public void TestAddClaimToQueue() { repoWindow.loadQueue(); ClaimContent controlData = new ClaimContent("1", (ClaimType)1, "Car accident on 465.", Decimal.Parse("400.00"), DateTime.Parse("2018-04-25"), DateTime.Parse("2018-04-27"), true); repoWindow.AddClaimToQueue(controlData); int tempVar = repoWindow._claimsQueue.Count; Assert.AreEqual(4, tempVar); }
// Seed Method private void SeedClaim() { ClaimContent carAccident = new ClaimContent(1, ClaimType.Car, "Wreck on I-69", 1500m, "08/20/2020", "09/14/2020", true); ClaimContent homeClaim = new ClaimContent(2, ClaimType.Home, "Kitchen fire", 5500m, "08/10/2020", "09/09/2020", true); ClaimContent theftClaim = new ClaimContent(3, ClaimType.Theft, "Stolen phone", 1000m, "07/30/2020", "09/14/2020", false); _claimsRepo.AddClaimToList(carAccident); _claimsRepo.AddClaimToList(homeClaim); _claimsRepo.AddClaimToList(theftClaim); }
private void DefaultClaims() { ClaimContent torres = new ClaimContent(1, TypesOfClaims.Car, "Car Accident on 465.", 400, new DateTime(2018, 4, 25), new DateTime(2018, 4, 27), true); ClaimContent owen = new ClaimContent(2, TypesOfClaims.Home, "House fire in kitchen.", 4000, new DateTime(2018, 4, 11), new DateTime(2018, 4, 12), true); ClaimContent ruudberg = new ClaimContent(3, TypesOfClaims.Theft, "Stolen bike.", 4, new DateTime(2018, 4, 27), new DateTime(2018, 6, 01), false); _claimRepo.AddClaim(torres); _claimRepo.AddClaim(owen); _claimRepo.AddClaim(ruudberg); }
public void ManagerDealWithClaim() { if (_claimRepo.HasContent()) { Console.Clear(); Console.WriteLine(">Take Care of Next Claim"); //public ClaimContent content =_claimRepo.DealWithClaim(); ClaimContent content = _claimRepo.ViewNextClaim(); string[] headers = new string[] { "ClaimID", "Type", "Description of Accident", "Amount", "Date of Accident", "Date of Claim", "IsValid" }; UI_Format ConsoleFormatter = new UI_Format(1, UI_Format.Align.Left, headers); #region DATA //List<ClaimContent> string[][] data = new string[][] { new string[] { $"{content.ClaimNumber}", $"{content.ClaimType}", $"{content.ClaimDescription}", $"${content.ClaimAmount}", $"{content.DateOfAccident}", $"{content.DateOfClaim}", $"{content.IsValid}" }, }; #endregion ArrayList arr = new ArrayList(data); ConsoleFormatter.RePrint(arr); //Get data variable from the link in the description Console.WriteLine($">Would You Like to Deal With This Claim? (Y/N)"); string nextClaimInput = Console.ReadLine().ToLower(); switch (nextClaimInput) { case "y": case "yes": ManagerRemoveOrDealAnyClaim(content.ClaimType); break; case "n": case "no": CancelTakingCareOfManagerClaim(content.ClaimType); break; default: ErrorOnMainClaimScreen(nextClaimInput); break; } } else { Console.Clear(); Console.WriteLine($">Take Care of Next Claim" + $"\nGood Work! All Claims Have Been Dealt With!" + $"\nLet's Work on Adding New Claims to Deal With!" + $"\nPress Enter to Return to the Manager Menu..."); Console.ReadLine(); ManagerOptions(); } }
public void AddNewClaimtoQueueTest() { ClaimContent claimOne = new ClaimContent(1, ClaimType.Car, "Car accident on 465", 400.00m, new DateTime(2018, 04, 25), new DateTime(2018, 04, 27), true); _repoTest.EnterNewClaim(claimOne); int expected = 1; int actual = _repoTest.GetListOfClaims().Count; Assert.AreEqual(expected, actual); }
public void EnterNewClaimTest() { //arrange ClaimContent content = new ClaimContent(); //act bool addClaim = _repoTest.EnterNewClaim(content); //assert Assert.IsTrue(addClaim); }
// Create New Claim private void CreateNewClaim() { Console.Clear(); ClaimContent newClaim = new ClaimContent(); // ClaimID Console.WriteLine("Enter the new ClaimID:"); string claimIDAsString = Console.ReadLine(); newClaim.ClaimID = int.Parse(claimIDAsString); // ClaimType Console.WriteLine("Enter the new Claim Type Number:\n" + "1. Car\n" + "2. Home\n" + "3. Theft"); string claimTypeAsString = Console.ReadLine(); int claimTypeAsInt = int.Parse(claimTypeAsString); newClaim.TypeOfClaim = (ClaimType)claimTypeAsInt; // Description Console.WriteLine("Enter the description of the new claim:"); newClaim.Description = Console.ReadLine(); // ClaimAmount Console.WriteLine("Enter the amount of new claim"); string claimAmountAsString = Console.ReadLine(); newClaim.ClaimAmount = decimal.Parse(claimAmountAsString); // DateOfIncident Console.WriteLine("Enter the date of the incident the claim occured: (mm/dd/yyyy)"); newClaim.DateOfIncident = Console.ReadLine(); // DateOfClaim Console.WriteLine("Enter the date the new claim was submitted: (mm/dd/yyyy)"); newClaim.DateOfClaim = Console.ReadLine(); // IsValid Console.WriteLine("Is the date of the claim within 30 calendar days of the incident date? (Y/N)"); string isValidString = Console.ReadLine().ToLower(); if (isValidString == "y") { newClaim.IsValid = true; } else { newClaim.IsValid = false; } _claimsRepo.AddClaimToList(newClaim); }