WeaverClientServerAttributeTests: remove dependencies on Weaver.weaverTypes

This commit is contained in:
vis2k 2021-08-21 16:30:36 +08:00
parent eb04bb4d58
commit 59b2d731ea

View File

@ -8,22 +8,22 @@ namespace Mirror.Weaver.Tests
{ {
public class WeaverClientServerAttributeTests : WeaverTestsBuildFromTestName public class WeaverClientServerAttributeTests : WeaverTestsBuildFromTestName
{ {
// Debug.Log on WeaverTypes to see the strings
const string NetworkServerGetActive = "System.Boolean Mirror.NetworkServer::get_active()";
const string NetworkClientGetActive = "System.Boolean Mirror.NetworkClient::get_active()";
[Test] [Test]
public void NetworkBehaviourServer() public void NetworkBehaviourServer()
{ {
IsSuccess(); IsSuccess();
CheckAddedCode(NetworkServerGetActive, "WeaverClientServerAttributeTests.NetworkBehaviourServer.NetworkBehaviourServer", "ServerOnlyMethod");
string networkServerGetActive = CompilationFinishedHook.weaver.weaverTypes.NetworkServerGetActive.ToString();
CheckAddedCode(networkServerGetActive, "WeaverClientServerAttributeTests.NetworkBehaviourServer.NetworkBehaviourServer", "ServerOnlyMethod");
} }
[Test] [Test]
public void ServerAttributeOnVirutalMethod() public void ServerAttributeOnVirutalMethod()
{ {
IsSuccess(); IsSuccess();
CheckAddedCode(NetworkServerGetActive, "WeaverClientServerAttributeTests.ServerAttributeOnVirutalMethod.ServerAttributeOnVirutalMethod", "ServerOnlyMethod");
string networkServerGetActive = CompilationFinishedHook.weaver.weaverTypes.NetworkServerGetActive.ToString();
CheckAddedCode(networkServerGetActive, "WeaverClientServerAttributeTests.ServerAttributeOnVirutalMethod.ServerAttributeOnVirutalMethod", "ServerOnlyMethod");
} }
[Test] [Test]
@ -37,27 +37,21 @@ public void ServerAttributeOnAbstractMethod()
public void ServerAttributeOnOverrideMethod() public void ServerAttributeOnOverrideMethod()
{ {
IsSuccess(); IsSuccess();
CheckAddedCode(NetworkServerGetActive, "WeaverClientServerAttributeTests.ServerAttributeOnOverrideMethod.ServerAttributeOnOverrideMethod", "ServerOnlyMethod");
string networkServerGetActive = CompilationFinishedHook.weaver.weaverTypes.NetworkServerGetActive.ToString();
CheckAddedCode(networkServerGetActive, "WeaverClientServerAttributeTests.ServerAttributeOnOverrideMethod.ServerAttributeOnOverrideMethod", "ServerOnlyMethod");
} }
[Test] [Test]
public void NetworkBehaviourClient() public void NetworkBehaviourClient()
{ {
IsSuccess(); IsSuccess();
CheckAddedCode(NetworkClientGetActive, "WeaverClientServerAttributeTests.NetworkBehaviourClient.NetworkBehaviourClient", "ClientOnlyMethod");
string networkClientGetActive = CompilationFinishedHook.weaver.weaverTypes.NetworkClientGetActive.ToString();
CheckAddedCode(networkClientGetActive, "WeaverClientServerAttributeTests.NetworkBehaviourClient.NetworkBehaviourClient", "ClientOnlyMethod");
} }
[Test] [Test]
public void ClientAttributeOnVirutalMethod() public void ClientAttributeOnVirutalMethod()
{ {
IsSuccess(); IsSuccess();
CheckAddedCode(NetworkClientGetActive, "WeaverClientServerAttributeTests.ClientAttributeOnVirutalMethod.ClientAttributeOnVirutalMethod", "ClientOnlyMethod");
string networkClientGetActive = CompilationFinishedHook.weaver.weaverTypes.NetworkClientGetActive.ToString();
CheckAddedCode(networkClientGetActive, "WeaverClientServerAttributeTests.ClientAttributeOnVirutalMethod.ClientAttributeOnVirutalMethod", "ClientOnlyMethod");
} }
[Test] [Test]
@ -71,63 +65,49 @@ public void ClientAttributeOnAbstractMethod()
public void ClientAttributeOnOverrideMethod() public void ClientAttributeOnOverrideMethod()
{ {
IsSuccess(); IsSuccess();
CheckAddedCode(NetworkClientGetActive, "WeaverClientServerAttributeTests.ClientAttributeOnOverrideMethod.ClientAttributeOnOverrideMethod", "ClientOnlyMethod");
string networkClientGetActive = CompilationFinishedHook.weaver.weaverTypes.NetworkClientGetActive.ToString();
CheckAddedCode(networkClientGetActive, "WeaverClientServerAttributeTests.ClientAttributeOnOverrideMethod.ClientAttributeOnOverrideMethod", "ClientOnlyMethod");
} }
[Test] [Test]
public void StaticClassClient() public void StaticClassClient()
{ {
IsSuccess(); IsSuccess();
CheckAddedCode(NetworkClientGetActive, "WeaverClientServerAttributeTests.StaticClassClient.StaticClassClient", "ClientOnlyMethod");
string networkClientGetActive = CompilationFinishedHook.weaver.weaverTypes.NetworkClientGetActive.ToString();
CheckAddedCode(networkClientGetActive, "WeaverClientServerAttributeTests.StaticClassClient.StaticClassClient", "ClientOnlyMethod");
} }
[Test] [Test]
public void RegularClassClient() public void RegularClassClient()
{ {
IsSuccess(); IsSuccess();
CheckAddedCode(NetworkClientGetActive, "WeaverClientServerAttributeTests.RegularClassClient.RegularClassClient", "ClientOnlyMethod");
string networkClientGetActive = CompilationFinishedHook.weaver.weaverTypes.NetworkClientGetActive.ToString();
CheckAddedCode(networkClientGetActive, "WeaverClientServerAttributeTests.RegularClassClient.RegularClassClient", "ClientOnlyMethod");
} }
[Test] [Test]
public void MonoBehaviourClient() public void MonoBehaviourClient()
{ {
IsSuccess(); IsSuccess();
CheckAddedCode(NetworkClientGetActive, "WeaverClientServerAttributeTests.MonoBehaviourClient.MonoBehaviourClient", "ClientOnlyMethod");
string networkClientGetActive = CompilationFinishedHook.weaver.weaverTypes.NetworkClientGetActive.ToString();
CheckAddedCode(networkClientGetActive, "WeaverClientServerAttributeTests.MonoBehaviourClient.MonoBehaviourClient", "ClientOnlyMethod");
} }
[Test] [Test]
public void StaticClassServer() public void StaticClassServer()
{ {
IsSuccess(); IsSuccess();
CheckAddedCode(NetworkServerGetActive, "WeaverClientServerAttributeTests.StaticClassServer.StaticClassServer", "ServerOnlyMethod");
string networkServerGetActive = CompilationFinishedHook.weaver.weaverTypes.NetworkServerGetActive.ToString();
CheckAddedCode(networkServerGetActive, "WeaverClientServerAttributeTests.StaticClassServer.StaticClassServer", "ServerOnlyMethod");
} }
[Test] [Test]
public void RegularClassServer() public void RegularClassServer()
{ {
IsSuccess(); IsSuccess();
CheckAddedCode(NetworkServerGetActive, "WeaverClientServerAttributeTests.RegularClassServer.RegularClassServer", "ServerOnlyMethod");
string networkServerGetActive = CompilationFinishedHook.weaver.weaverTypes.NetworkServerGetActive.ToString();
CheckAddedCode(networkServerGetActive, "WeaverClientServerAttributeTests.RegularClassServer.RegularClassServer", "ServerOnlyMethod");
} }
[Test] [Test]
public void MonoBehaviourServer() public void MonoBehaviourServer()
{ {
IsSuccess(); IsSuccess();
CheckAddedCode(NetworkServerGetActive, "WeaverClientServerAttributeTests.MonoBehaviourServer.MonoBehaviourServer", "ServerOnlyMethod");
string networkServerGetActive = CompilationFinishedHook.weaver.weaverTypes.NetworkServerGetActive.ToString();
CheckAddedCode(networkServerGetActive, "WeaverClientServerAttributeTests.MonoBehaviourServer.MonoBehaviourServer", "ServerOnlyMethod");
} }
// Checks that first Instructions in MethodBody is addedString // Checks that first Instructions in MethodBody is addedString