diff --git a/.drone.yml b/.drone.yml index c0d3d61..1931e50 100644 --- a/.drone.yml +++ b/.drone.yml @@ -6,4 +6,4 @@ steps: - name: run image: mcr.microsoft.com/dotnet/sdk:latest commands: - - dotnet run + - dotnet test diff --git a/aoc.tests/Day1Test.cs b/aoc.tests/Day1Test.cs new file mode 100644 index 0000000..7c56dcf --- /dev/null +++ b/aoc.tests/Day1Test.cs @@ -0,0 +1,29 @@ +using aoc2020; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace aoc.tests +{ + [TestClass] + public class Day1Test + { + private Day1 _day1; + + [TestInitialize] + public void Initialize() + { + _day1 = new Day1(); + } + + [TestMethod] + public void TestPart1() + { + Assert.AreEqual("751776", _day1.Part1()); + } + + [TestMethod] + public void TestPart2() + { + Assert.AreEqual("42275090", _day1.Part2()); + } + } +} \ No newline at end of file diff --git a/aoc.tests/Day2Test.cs b/aoc.tests/Day2Test.cs new file mode 100644 index 0000000..b2434ca --- /dev/null +++ b/aoc.tests/Day2Test.cs @@ -0,0 +1,29 @@ +using aoc2020; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace aoc.tests +{ + [TestClass] + public class Day2Test + { + private Day2 _day2; + + [TestInitialize] + public void Initialize() + { + _day2 = new Day2(); + } + + [TestMethod] + public void TestPart1() + { + Assert.AreEqual("556", _day2.Part1()); + } + + [TestMethod] + public void TestPart2() + { + Assert.AreEqual("605", _day2.Part2()); + } + } +} \ No newline at end of file diff --git a/aoc.tests/aoc.tests.csproj b/aoc.tests/aoc.tests.csproj new file mode 100644 index 0000000..cabfef9 --- /dev/null +++ b/aoc.tests/aoc.tests.csproj @@ -0,0 +1,20 @@ + + + + net5.0 + + false + + + + + + + + + + + + + + diff --git a/aoc2020.sln b/aoc2020.sln index 64abd9a..3a32f4b 100644 --- a/aoc2020.sln +++ b/aoc2020.sln @@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.30709.132 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "aoc2020", "aoc2020.csproj", "{3D60F1A0-0DD9-4FF9-B85B-D491B13ACAE7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "aoc2020", "aoc2020\aoc2020.csproj", "{3D60F1A0-0DD9-4FF9-B85B-D491B13ACAE7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "aoc.tests", "aoc.tests\aoc.tests.csproj", "{4E841B34-CF2F-4751-B31D-8E1D5FCEC8F6}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,6 +17,10 @@ Global {3D60F1A0-0DD9-4FF9-B85B-D491B13ACAE7}.Debug|Any CPU.Build.0 = Debug|Any CPU {3D60F1A0-0DD9-4FF9-B85B-D491B13ACAE7}.Release|Any CPU.ActiveCfg = Release|Any CPU {3D60F1A0-0DD9-4FF9-B85B-D491B13ACAE7}.Release|Any CPU.Build.0 = Release|Any CPU + {4E841B34-CF2F-4751-B31D-8E1D5FCEC8F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4E841B34-CF2F-4751-B31D-8E1D5FCEC8F6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4E841B34-CF2F-4751-B31D-8E1D5FCEC8F6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4E841B34-CF2F-4751-B31D-8E1D5FCEC8F6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Day.cs b/aoc2020/Day.cs similarity index 100% rename from Day.cs rename to aoc2020/Day.cs diff --git a/Day1.cs b/aoc2020/Day1.cs similarity index 95% rename from Day1.cs rename to aoc2020/Day1.cs index ceb7850..b2a5bfa 100644 --- a/Day1.cs +++ b/aoc2020/Day1.cs @@ -3,7 +3,7 @@ using System.Linq; namespace aoc2020 { - internal sealed class Day1 : Day + public sealed class Day1 : Day { private readonly ImmutableHashSet _entries; diff --git a/Day2.cs b/aoc2020/Day2.cs similarity index 97% rename from Day2.cs rename to aoc2020/Day2.cs index 4038e26..5d1e579 100644 --- a/Day2.cs +++ b/aoc2020/Day2.cs @@ -3,7 +3,7 @@ using System.Linq; namespace aoc2020 { - internal sealed class Day2 : Day + public sealed class Day2 : Day { private readonly ImmutableList _passwords; diff --git a/Program.cs b/aoc2020/Program.cs similarity index 100% rename from Program.cs rename to aoc2020/Program.cs diff --git a/aoc2020.csproj b/aoc2020/aoc2020.csproj similarity index 100% rename from aoc2020.csproj rename to aoc2020/aoc2020.csproj diff --git a/input/day1.in b/aoc2020/input/day1.in similarity index 100% rename from input/day1.in rename to aoc2020/input/day1.in diff --git a/input/day2.in b/aoc2020/input/day2.in similarity index 100% rename from input/day2.in rename to aoc2020/input/day2.in