Here are the examples of the csharp api Snapshooter.Xunit.XunitSnapshotFullNameReader.IsXunitTestMethod(System.Reflection.MemberInfo) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
19
Source : XunitSnapshotFullNameReader.cs
with MIT License
from SwissLife-OSS
with MIT License
from SwissLife-OSS
public SnapshotFullName ReadSnapshotFullName()
{
SnapshotFullName snapshotFullName = null;
StackFrame[] stackFrames = new StackTrace(true).GetFrames();
foreach (StackFrame stackFrame in stackFrames)
{
MethodBase method = stackFrame.GetMethod();
if (IsXunitTestMethod(method))
{
snapshotFullName = new SnapshotFullName(
method.ToName(),
Path.GetDirectoryName(stackFrame.GetFileName()));
break;
}
MethodBase asyncMethod = EvaluateAsynchronMethodBase(method);
if (IsXunitTestMethod(asyncMethod))
{
snapshotFullName = new SnapshotFullName(
asyncMethod.ToName(),
Path.GetDirectoryName(stackFrame.GetFileName()));
break;
}
}
if (snapshotFullName == null)
{
throw new SnapshotTestException(
"The snapshot full name could not be evaluated. " +
"This error can occur, if you use the snapshot match " +
"within a async test helper child method. To solve this issue, " +
"use the Snapshot.FullName directly in the unit test to " +
"get the snapshot name, then reach this name to your " +
"Snapshot.Match method.");
}
snapshotFullName = LiveUnitTestingDirectoryResolver
.CheckForSession(snapshotFullName);
return snapshotFullName;
}