Initial commit

This commit is contained in:
Mark J Price 2022-02-19 19:56:52 +00:00
parent e523533d17
commit 10cceacca6
50 changed files with 1280 additions and 0 deletions

View file

@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CalculatorLib\CalculatorLib.csproj" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,35 @@
using CalculatorLib;
namespace CalculatorLibUnitTests
{
public class CalculatorUnitTests
{
[Fact]
public void TestAdding2And2()
{
// arrange
double a = 2;
double b = 2;
double expected = 4;
Calculator calc = new();
// act
double actual = calc.Add(a, b);
// assert
Assert.Equal(expected, actual);
}
[Fact]
public void TestAdding2And3()
{
// arrange
double a = 2;
double b = 3;
double expected = 5;
Calculator calc = new();
// act
double actual = calc.Add(a, b);
// assert
Assert.Equal(expected, actual);
}
}
}

View file

@ -0,0 +1 @@
global using Xunit;