public Day24SolverTest()
        {
            var groups = new List <Day24Solver.Group>
            {
                new Day24Solver.Group(Day24Solver.Group.GroupType.ImmuneSystem, 17, 5390, 4507, "fire", 2),
                new Day24Solver.Group(Day24Solver.Group.GroupType.ImmuneSystem, 989, 1274, 25, "slashing", 3),
                new Day24Solver.Group(Day24Solver.Group.GroupType.Infection, 801, 4706, 116, "bludgeoning", 1),
                new Day24Solver.Group(Day24Solver.Group.GroupType.Infection, 4485, 2961, 12, "slashing", 4)
            };

            groups[0].Weaknesses.Add("radiation");
            groups[0].Weaknesses.Add("bludgeoning");
            groups[1].Immunities.Add("fire");
            groups[1].Weaknesses.Add("bludgeoning");
            groups[1].Weaknesses.Add("slashing");
            groups[2].Weaknesses.Add("radiation");
            groups[3].Immunities.Add("radiation");
            groups[3].Weaknesses.Add("fire");
            groups[3].Weaknesses.Add("cold");
            sample = new Day24Solver.ImmuneCombat();
            sample.Groups.Add(groups[0]);
            sample.Groups.Add(groups[1]);
            sample.Groups.Add(groups[2]);
            sample.Groups.Add(groups[3]);

            var dataProvider = new Mock <DataProvider <Day24Solver.ImmuneCombat> >();

            dataProvider.Setup(dp => dp.GetData()).Returns(sample);
            solver = new Day24Solver(dataProvider.Object);
        }
        public void SimulateTest(string input, int minutes, string expectedCells)
        {
            Day24Solver solver = new Day24Solver(input);

            solver.Simulate(minutes);

            Assert.AreEqual(expectedCells, solver.GetCells());
        }
Example #3
0
        public void TestPart1Solution(string inputFile, int expected)
        {
            // Arrange
            string[] lines = System.IO.File.ReadAllLines($"../../../{inputFile}");

            // Act
            var result = Day24Solver.Part1Solution(lines);

            // Assert
            Assert.Equal(expected, result);
        }
 public void ReturnsSmallestWinningBoost()
 {
     Assert.Equal(1570, Day24Solver.GetSmallestWinningBoost(sample));
 }
Example #5
0
 public void SetUp()
 {
     _solver = new Day24Solver();
     _input  = new Day24Input();
 }