test class name matches file name

This commit is contained in:
Paul Pacheco 2020-04-22 17:40:32 -05:00
parent 5214b57db5
commit dfffe26390
3 changed files with 7 additions and 18 deletions

View File

@ -13,7 +13,9 @@ public void NetworkBehaviourServer()
{
Assert.That(CompilationFinishedHook.WeaveFailed, Is.False);
Assert.That(weaverErrors, Is.Empty);
CheckAddedCodeServer();
string networkServerGetActive = Weaver.NetworkServerGetActive.ToString();
CheckAddedCode(networkServerGetActive, "MirrorTest.NetworkBehaviourServer", "ServerOnlyMethod");
}
[Test]
@ -21,19 +23,8 @@ public void NetworkBehaviourClient()
{
Assert.That(CompilationFinishedHook.WeaveFailed, Is.False);
Assert.That(weaverErrors, Is.Empty);
CheckAddedCodeClient();
}
static void CheckAddedCodeServer()
{
string networkServerGetActive = Weaver.NetworkServerGetActive.ToString();
CheckAddedCode(networkServerGetActive, "ServerOnlyMethod");
}
static void CheckAddedCodeClient()
{
string networkClientGetActive = Weaver.NetworkClientGetActive.ToString();
CheckAddedCode(networkClientGetActive, "ClientOnlyMethod");
CheckAddedCode(networkClientGetActive, "MirrorTest.NetworkBehaviourClient", "ClientOnlyMethod");
}
/// <summary>
@ -41,10 +32,8 @@ static void CheckAddedCodeClient()
/// </summary>
/// <param name="addedString"></param>
/// <param name="methodName"></param>
static void CheckAddedCode(string addedString, string methodName)
static void CheckAddedCode(string addedString, string className, string methodName)
{
string className = "MirrorTest.MirrorTestPlayer";
string assemblyName = Path.Combine(WeaverAssembler.OutputDirectory, WeaverAssembler.OutputFile);
using (AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly(assemblyName))
{

View File

@ -5,7 +5,7 @@
namespace MirrorTest
{
class MirrorTestPlayer : NetworkBehaviour
class NetworkBehaviourClient : NetworkBehaviour
{
[Client]
void ClientOnlyMethod()

View File

@ -5,7 +5,7 @@
namespace MirrorTest
{
class MirrorTestPlayer : NetworkBehaviour
class NetworkBehaviourServer : NetworkBehaviour
{
[Server]
void ServerOnlyMethod()