parent
9a9b872f7e
commit
e5b016460e
@ -0,0 +1,17 @@
|
||||
namespace Infrastructure.Tests;
|
||||
|
||||
public class GenericTests
|
||||
{
|
||||
[Fact]
|
||||
public void ValueConvertTest()
|
||||
{
|
||||
var value = "7";
|
||||
var convertedValue = Convert<long>(value);
|
||||
Assert.Equal(7, convertedValue);
|
||||
}
|
||||
|
||||
private static T Convert<T>(string value) where T : IEquatable<T>
|
||||
{
|
||||
return (T)System.Convert.ChangeType(value, typeof(T));
|
||||
}
|
||||
}
|
Loading…
Reference in new issue