feat: Finish lecture

This commit is contained in:
Louis Gallet 2023-10-12 09:54:49 +02:00
parent ee1cbcfcda
commit db002ef186
Signed by: lgallet
SSH Key Fingerprint: SHA256:qnW7pk4EoMRR0UftZLZQKSMUImbEFsiruLC7jbCHJAY
3 changed files with 20 additions and 3 deletions

View File

@ -22,4 +22,8 @@
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Lecture\Lecture.csproj" />
</ItemGroup>
</Project> </Project>

View File

@ -2,8 +2,20 @@ namespace Tests;
public class UnitTest1 public class UnitTest1
{ {
[Fact] [Theory]
public void Test1() [InlineData("123456", 123456)]
[InlineData("214213", 214213)]
[InlineData("987621", 987621)]
public void TestStringToInt(string a, int expected)
{ {
Assert.Equal(Lecture.Exercises.Conversion.StringToInt(a), expected);
}
[Theory]
[InlineData("12345", typeof(IndexOutOfRangeException))]
[InlineData("123A56", typeof(FormatException))]
public void TestStringToIntException(string value, Type expected)
{
Assert.Throws(expected, () => Lecture.Exercises.Conversion.StringToInt(value));
} }
} }

View File

@ -1 +1,2 @@
global using Xunit; global using Xunit;
global using Lecture;