public void ClaimsTestsArrange() { _claimQueue = new ClaimRepo(); var claim1 = new Claim(TypeOfClaim.Car, "Car accident on 465.", 400.00, new DateTime(2018, 4, 25), new DateTime(2018, 4, 27)); var claim2 = new Claim(TypeOfClaim.Home, "House fire in kitchen.", 4000.00, new DateTime(2018, 4, 11), new DateTime(2018, 4, 12)); _claimQueue.AddClaimToQueue(claim1); _claimQueue.AddClaimToQueue(claim2); }
private void SeedData() { var seedClaim1 = new Claim(TypeOfClaim.Car, "Car accident on 465.", 400.00, new DateTime(2018, 4, 25), new DateTime(2018, 4, 27)); var seedClaim2 = new Claim(TypeOfClaim.Home, "House fire in kitchen.", 4000.00, new DateTime(2018, 4, 11), new DateTime(2018, 4, 12)); var seedClaim3 = new Claim(TypeOfClaim.Theft, "Stolen pancakes.", 4.00, new DateTime(2018, 4, 27), new DateTime(2018, 4, 27)); _claimQueue.AddClaimToQueue(seedClaim1); _claimQueue.AddClaimToQueue(seedClaim2); _claimQueue.AddClaimToQueue(seedClaim3); }
//case 3 private void CreateNewClaim() { Console.Clear(); Claim newClaim = new Claim(); int counter = _claimRepo.CountMethod(); newClaim.ClaimID = System.Threading.Interlocked.Increment(ref counter); /* Console.WriteLine("Enter the Claim ID:"); * string IDAsString = Console.ReadLine(); * newClaim.ClaimID = int.Parse(IDAsString);*/ Console.WriteLine("Enter claim type:\n" + "1. Car\n" + "2. Home\n" + "3. Theft"); string typeAsString = Console.ReadLine(); int typeAsInt = int.Parse(typeAsString); newClaim.TypeOfClaim = (ClaimType)typeAsInt; Console.WriteLine("Enter a claim description:"); newClaim.Description = Console.ReadLine(); Console.WriteLine("Amount of Damage:"); string amountAsString = Console.ReadLine(); newClaim.ClaimAmount = decimal.Parse(amountAsString); Console.WriteLine("Date of Accident:"); string incidentDateAsString = Console.ReadLine(); newClaim.DateOfIncident = DateTime.Parse(incidentDateAsString); Console.WriteLine("Date of Claim:"); string claimDateAsString = Console.ReadLine(); newClaim.DateOfClaim = DateTime.Parse(claimDateAsString); /* Console.WriteLine("Is this claim valid?(Y/N)"); * string isValid = Console.ReadLine().ToLower(); * if (isValid == "y") * { * newClaim.IsValid = true; * } * else * { * newClaim.IsValid = false; * }*/ _claimRepo.AddClaimToQueue(newClaim); }
//add to queue private void AddNewClaim() { Console.Clear(); Claim newClaim = new Claim(); Console.WriteLine("Enter the Claim ID number:"); string idAsString = Console.ReadLine(); newClaim.ClaimID = int.Parse(idAsString); Console.WriteLine("Enter the claim type:\n" + "1. Car\n" + "2. Home\n" + "3. Theft"); string typeAsString = Console.ReadLine(); int typeAsInt = int.Parse(typeAsString); newClaim.TypeOfClaim = (ClaimType)typeAsInt; Console.WriteLine("Enter the description for the claim:"); newClaim.Description = Console.ReadLine(); Console.WriteLine("Enter the claim amount:"); string amountAsString = Console.ReadLine(); newClaim.ClaimAmount = decimal.Parse(amountAsString); Console.WriteLine("Enter the date of the incident: (yyyy/mm/dd)"); string incidentDateString = Console.ReadLine(); newClaim.DateOfIncident = DateTime.Parse(incidentDateString); Console.WriteLine("Enter the date the claim was placed: (yyyy/mm/dd)"); string claimDateString = Console.ReadLine(); newClaim.DateOfClaim = DateTime.Parse(claimDateString); Console.WriteLine("Is this claim valid? (y/n)"); string validAsString = Console.ReadLine().ToLower(); if (validAsString == "y") { newClaim.IsValid = true; } else { newClaim.IsValid = false; } _claimRepo.AddClaimToQueue(newClaim); }
public void ClaimRepo_AddClaimToQueue_ShouldBeCorrect() { Claim claim = new Claim(); Claim claimTwo = new Claim(); ClaimRepo repo = new ClaimRepo(); repo.AddClaimToQueue(claim); repo.AddClaimToQueue(claimTwo); int actual = repo.GetQueue().Count; int expected = 2; Assert.AreEqual(expected, actual); }
public void Arrange() { _repo = new ClaimRepo(); _content = new Claim(4, ClaimType.Theft, "Stole the Crown Jewels", "$1,000,000,000,", new DateTime(2020, 7, 28), new DateTime(2020, 8, 30), false); _repo.AddClaimToQueue(_content); }
public void Arrange() { _claimDirectory = new ClaimRepo(); _claim = new Claim("1", ClaimType.Car, "Car accident on 465", 400.00, DateTime.Parse("2018-04-25"), DateTime.Parse("2018-04-27"), true); _claimDirectory.AddClaimToQueue(_claim); }
public void Arrange() { _claimRepo = new ClaimRepo(); _claim = new Claim((ClaimType)3, "Stolen swag", 4.00m, new DateTime(2018, 12, 30), new DateTime(2019, 01, 31)); _claimRepo.AddClaimToQueue(_claim); }
public void Arrange() { _repo = new ClaimRepo(); _claim = new Claim(1, ClaimType.Car, "Car accident on 465.", 400.00m, new DateTime(2018, 04, 25), new DateTime(2018, 04, 27), true); _repo.AddClaimToQueue(_claim); }
private void CreateNewClaim() { Console.Clear(); Claim newClaim = new Claim(); Console.WriteLine("Enter the new Claim Id:"); string claimIdAsString = Console.ReadLine(); int claimIdAsInt = int.Parse(claimIdAsString); newClaim.ClaimId = claimIdAsInt; Console.WriteLine("\nEnter the Claim Type Number:\n" + "1. Car\n" + "2. Home\n" + "3. Theft\n"); string claimTypeAsString = Console.ReadLine(); int claimTypeAsInt = int.Parse(claimTypeAsString); newClaim.TypeOfClaim = (ClaimType)claimTypeAsInt; Console.WriteLine("\nEnter the Claim Description:"); newClaim.Description = Console.ReadLine(); Console.WriteLine("\nEnter the Amount of Damage:"); newClaim.ClaimAmount = Console.ReadLine(); Console.WriteLine("\nEnter the Date of Accident: (mm/dd/yyyy)"); string accidentDateAsString = Console.ReadLine(); DateTime accidentDateAsObject = DateTime.Parse(accidentDateAsString); newClaim.DateOfIncident = accidentDateAsObject; Console.WriteLine("\nEnter the Date of Claim: (mm/dd/yyyy)"); string dateOfClaimAsString = Console.ReadLine(); DateTime dateOfClaimAsObject = DateTime.Parse(dateOfClaimAsString); newClaim.DateOfClaim = dateOfClaimAsObject; // Call isValid helper method bool isValid = _claims.IsClaimValid(); newClaim.IsValid = isValid; Console.WriteLine($"\nIsValid: {isValid}"); _claims.AddClaimToQueue(newClaim); }
public void AddClaimToQueue_ShouldGetCorrectBoolean() { Claims claim = new Claims(); ClaimRepo repository = new ClaimRepo(); bool addClaim = repository.AddClaimToQueue(claim); Assert.IsTrue(addClaim); }
public void RemoveClaimFromQueue() { ClaimRepo claimRepo = new ClaimRepo(); Claim claim = new Claim(); Claim claimTwo = new Claim(); Claim claimThree = new Claim(); claimRepo.AddClaimToQueue(claim); claimRepo.AddClaimToQueue(claimTwo); claimRepo.AddClaimToQueue(claimThree); claimRepo.RemoveClaimFromQueue(); int actual = claimRepo.GetQueue().Count; int expected = 2; Assert.AreEqual(expected, actual); }
public void RunMenu() { Claims auto = new Claims(1, "Auto", "Broken window", 125.00m, "12/12/2012", "12/20/2012", true); Claims home = new Claims(2, "Home", "Fire", 4000.00m, "11/15/2015", "12/25/2015", false); claimRepo.AddClaimToQueue(auto); claimRepo.AddClaimToQueue(home); bool isRunning = true; while (isRunning) { Console.Clear(); Console.WriteLine("Choose an option:" + "\n1. See all claims" + "\n2. Take care of next claim" + "\n3. Enter a new claim" + "\n4. Exit"); int input = int.Parse(Console.ReadLine()); switch (input) { case 1: ShowAllClaims(); break; case 2: WorkNextClaim(); break; case 3: NewClaim(); break; case 4: isRunning = false; Console.WriteLine("Press any key to exit"); Console.ReadLine(); break; default: Console.WriteLine("invalid option"); break; } } }
public void AddClaimToQueue_ShouldGetNotNull() { // Act Queue <Claim> content = new Queue <Claim>(); _repo.AddClaimToQueue(_content); // Assert Assert.IsNotNull(content); }
public void AddClaimToQueue_ShouldReturnTrue() { //Arrange //Act _claimRepo.AddClaimToQueue(_claim); Claim claimFromDirectory = _claimRepo.GetClaimByID(3); //Assert Assert.IsTrue(_claimRepo.GetClaimQueue().Contains(_claim)); }
public void ShowAllClaims_ShouldReturnCorrectQueue() { Claims claim = new Claims(); ClaimRepo repository = new ClaimRepo(); repository.AddClaimToQueue(claim); Queue <Claims> claims = repository.ShowAllClaims(); bool QueueHasClaims = claims.Contains(claim); Assert.IsTrue(QueueHasClaims); }
public void AddToQueue_ShouldGetNotNull() { //Arrange --> Setting up the Playing Field Claim claim = new Claim("1", ClaimType.Car, "Car accident on 465", 400.00, DateTime.Parse("2018-04-25"), DateTime.Parse("2018-04-27"), true); ClaimRepo repo = new ClaimRepo(); //Act --> Get/run the code we want to test repo.AddClaimToQueue(claim); Claim claimFromDirectory = repo.GetClaimByID("1"); //Assert --> Use the assert class to verify the expected outcome. Assert.IsNotNull(claimFromDirectory); }
public void AddToQueue_ShouldNotNull() { //arrange Claim claim = new Claim(); claim.ClaimID = 1; ClaimRepo repo = new ClaimRepo(); //act repo.AddClaimToQueue(claim); Queue <Claim> claimInQueue = repo.GetClaimQueue(); //Assert Assert.IsNotNull(claimInQueue); }
public void DeleteTopClaimInQueue_ShouldReturnTrue() { //arrange Claim claim = new Claim(); claim.ClaimID = 1; ClaimRepo repo = new ClaimRepo(); //act repo.AddClaimToQueue(claim); //using test initializer data prior to delete //bool deleteResult = _repo.DequeueClaim(); this is the exact same, good habit to do both bool deleteResult = repo.DequeueClaim(); //assert Assert.IsTrue(deleteResult); }
public void NewClaim() { Console.Clear(); Claims claim = new Claims(); Console.WriteLine("New Claim Portal"); Console.WriteLine("Enter Claim ID:"); claim.ClaimID = int.Parse(Console.ReadLine()); Console.WriteLine("Select Claim Type:\n" + "1. Auto\n" + "2. Home\n" + "3. Phone\n" + "4. Life"); string claimTypeInput = Console.ReadLine(); switch (claimTypeInput) { case "1": claim.ClaimType = ClaimType.Auto; break; case "2": claim.ClaimType = ClaimType.Home; break; case "3": claim.ClaimType = ClaimType.Phone; break; case "4": claim.ClaimType = ClaimType.Life; break; } Console.WriteLine("Enter Claim Description:"); claim.ClaimDescription = Console.ReadLine(); Console.WriteLine("Enter Claim Amount (excluding $):"); claim.ClaimPrice = double.Parse(Console.ReadLine()); Console.WriteLine("Enter Date of Incident (mm/dd/yyyy):"); claim.DateOfIncident = DateTime.Parse(Console.ReadLine()); Console.WriteLine("Enter Date of Claim (mm/dd/yyyy):"); claim.DateOfClaim = DateTime.Parse(Console.ReadLine()); _ClaimsQueueRepo.AddClaimToQueue(claim); }
public void TestForAddingClaimToQ() { var claim3 = new Claim(TypeOfClaim.Theft, "Stolen pancakes.", 4.00, new DateTime(2018, 4, 27), new DateTime(2018, 4, 27)); _claimQueue.AddClaimToQueue(claim3); Queue <Claim> claimQueue = _claimQueue.GetAllClaims(); bool IDisEqual = false; foreach (Claim claim in claimQueue) { if (claim.ClaimID == claim3.ClaimID) { IDisEqual = true; break; } } Assert.IsTrue(IDisEqual); }
private void AddNewClaim() { Console.Clear(); //Build a new object Claim newClaim = new Claim(); //ID Number Console.WriteLine("Enter the unique ID of the Claim:"); newClaim.ClaimID = Console.ReadLine(); //Type Console.WriteLine("Enter the Claim Type number:\n" + "1. Car\n" + "2. Home\n" + "3. Theft"); string typeAsString = Console.ReadLine(); int typeAsInt = int.Parse(typeAsString); newClaim.ClaimType = (ClaimType)typeAsInt; //Description Console.WriteLine("Enter the description of the Claim:"); newClaim.Description = Console.ReadLine(); //Amount Console.WriteLine("Add the claim amount (ex: 2000.00):"); string claimAmount = Console.ReadLine(); double claimAmountDouble = Convert.ToDouble(claimAmount); newClaim.ClaimAmount = claimAmountDouble; //Date of Incident Console.WriteLine("Enter the date of the incident for the Claim (DD-MM-YYYY):"); string incidentDate = Console.ReadLine(); DateTime incidentDateTime = Convert.ToDateTime(incidentDate); newClaim.DateOfIncident = incidentDateTime; //Date of Claim Console.WriteLine("Enter the date of the Claim (DD-MM-YYYY):"); string claimDate = Console.ReadLine(); DateTime claimDateTime = Convert.ToDateTime(claimDate); newClaim.DateOfClaim = claimDateTime; //Valid DateTime claim = claimDateTime; DateTime incident = incidentDateTime; int isValid = claim.Day - incident.Day; if (isValid < 30) { newClaim.IsValid = true; } else { newClaim.IsValid = false; } _ClaimRepo.AddClaimToQueue(newClaim); }