add unit-testing framework

This commit is contained in:
Colin McMillen 2020-11-30 11:26:04 -05:00
parent 77edeb3fc7
commit 273f4958b8
2 changed files with 22 additions and 2 deletions

View File

@ -3,6 +3,12 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<GenerateProgramFile>false</GenerateProgramFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
</ItemGroup>
</Project>

View File

@ -1,9 +1,23 @@
using System;
using static System.Console;
using System.Collections.Generic;
using Xunit;
namespace AdventOfCode {
class Program {
public class Program {
static string Hello() {
return "ahoy, world";
}
[Fact]
static void HelloTest() {
Assert.Equal("ahoy, world", Hello());
}
static void Main(string[] args) {
Console.WriteLine("Hello World!");
Console.WriteLine(Hello());
}
}
}