You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.5 KiB

using System;
namespace AOC2021.Test.Models
{
public class Answer
{
public string Day_A_Test { get; set; }
public string Day_A_Input { get; set; }
public string Day_B_Test { get; set; }
public string Day_B_Input { get; set; }
public override bool Equals(Object obj)
{
//Check for null and compare run-time types.
if ((obj == null) || !this.GetType().Equals(obj.GetType()))
{
return false;
}
else
{
Answer a = (Answer)obj;
string failedAnswer = string.Empty;
if (!Day_A_Input.Equals(a.Day_A_Input))
throw new Exception($"Failed Day A Input ({Day_A_Input}) vs ({a.Day_A_Input})");
if (!Day_A_Test.Equals(a.Day_A_Test))
throw new Exception($"Failed Day A Test ({Day_A_Test}) vs ({a.Day_A_Test})");
if (!Day_B_Input.Equals(a.Day_B_Input))
throw new Exception($"Failed Day B Input ({Day_B_Input}) vs ({a.Day_B_Input})");
if (!Day_B_Test.Equals(a.Day_B_Test))
throw new Exception($"Failed Day B Test ({Day_B_Test}) vs ({a.Day_B_Test})");
if (string.IsNullOrEmpty(failedAnswer))
{
return true;
}
Console.WriteLine(failedAnswer);
return false;
}
}
}
}