restructure project to add unit testing
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
ed0ec13dde
commit
370099c6ed
|
@ -6,4 +6,4 @@ steps:
|
||||||
- name: run
|
- name: run
|
||||||
image: mcr.microsoft.com/dotnet/sdk:latest
|
image: mcr.microsoft.com/dotnet/sdk:latest
|
||||||
commands:
|
commands:
|
||||||
- dotnet run
|
- dotnet test
|
||||||
|
|
29
aoc.tests/Day1Test.cs
Normal file
29
aoc.tests/Day1Test.cs
Normal file
|
@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
29
aoc.tests/Day2Test.cs
Normal file
29
aoc.tests/Day2Test.cs
Normal file
|
@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
20
aoc.tests/aoc.tests.csproj
Normal file
20
aoc.tests/aoc.tests.csproj
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
|
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
|
||||||
|
<PackageReference Include="MSTest.TestAdapter" Version="2.1.1" />
|
||||||
|
<PackageReference Include="MSTest.TestFramework" Version="2.1.1" />
|
||||||
|
<PackageReference Include="coverlet.collector" Version="1.3.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\aoc2020\aoc2020.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 16
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 16.0.30709.132
|
VisualStudioVersion = 16.0.30709.132
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
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
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
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}.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.ActiveCfg = Release|Any CPU
|
||||||
{3D60F1A0-0DD9-4FF9-B85B-D491B13ACAE7}.Release|Any CPU.Build.0 = 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
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
@ -3,7 +3,7 @@ using System.Linq;
|
||||||
|
|
||||||
namespace aoc2020
|
namespace aoc2020
|
||||||
{
|
{
|
||||||
internal sealed class Day1 : Day
|
public sealed class Day1 : Day
|
||||||
{
|
{
|
||||||
private readonly ImmutableHashSet<int> _entries;
|
private readonly ImmutableHashSet<int> _entries;
|
||||||
|
|
|
@ -3,7 +3,7 @@ using System.Linq;
|
||||||
|
|
||||||
namespace aoc2020
|
namespace aoc2020
|
||||||
{
|
{
|
||||||
internal sealed class Day2 : Day
|
public sealed class Day2 : Day
|
||||||
{
|
{
|
||||||
private readonly ImmutableList<Password> _passwords;
|
private readonly ImmutableList<Password> _passwords;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user