Add InheritenceTests
This commit is contained in:
parent
2f546030d8
commit
bd0c9067a0
46
test/Ben.Demystifier.Test/InheritenceTests.cs
Normal file
46
test/Ben.Demystifier.Test/InheritenceTests.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Ben.Demystifier.Test
|
||||||
|
{
|
||||||
|
public class InheritenceTests
|
||||||
|
{
|
||||||
|
private abstract class BaseClass
|
||||||
|
{
|
||||||
|
public abstract Task<object> Method();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ImplClass : BaseClass
|
||||||
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
|
public override Task<object> Method()
|
||||||
|
{
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task ImplementedAbstractMethodDoesNotThrow()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var instance = new ImplClass();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
Exception exception = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await instance.Method();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
exception = ex;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var est = new EnhancedStackTrace(exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user