feat: ✨ Finish lecture
This commit is contained in:
parent
ee1cbcfcda
commit
db002ef186
@ -22,4 +22,8 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Lecture\Lecture.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1 +1,2 @@
|
|||||||
global using Xunit;
|
global using Xunit;
|
||||||
|
global using Lecture;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user