test class name matches file name

This commit is contained in:
Paul Pacheco 2020-04-22 20:51:49 -05:00
parent d8e5f0d023
commit d0df3e8b90
14 changed files with 25 additions and 25 deletions

View File

@ -15,56 +15,56 @@ public void SyncVarsValid()
public void SyncVarsNoHook()
{
Assert.That(CompilationFinishedHook.WeaveFailed, Is.True);
Assert.That(weaverErrors, Contains.Item("Mirror.Weaver error: No hook implementation found for System.Int32 MirrorTest.MirrorTestPlayer::health. Add this method to your class:\npublic void OnChangeHealth(System.Int32 oldValue, System.Int32 newValue) { }"));
Assert.That(weaverErrors, Contains.Item("Mirror.Weaver error: No hook implementation found for System.Int32 MirrorTest.SyncVarsNoHook::health. Add this method to your class:\npublic void OnChangeHealth(System.Int32 oldValue, System.Int32 newValue) { }"));
}
[Test]
public void SyncVarsNoHookParams()
{
Assert.That(CompilationFinishedHook.WeaveFailed, Is.True);
Assert.That(weaverErrors, Contains.Item("Mirror.Weaver error: System.Void MirrorTest.MirrorTestPlayer::OnChangeHealth() should have signature:\npublic void OnChangeHealth(System.Int32 oldValue, System.Int32 newValue) { }"));
Assert.That(weaverErrors, Contains.Item("Mirror.Weaver error: System.Void MirrorTest.SyncVarsNoHookParams::OnChangeHealth() should have signature:\npublic void OnChangeHealth(System.Int32 oldValue, System.Int32 newValue) { }"));
}
[Test]
public void SyncVarsTooManyHookParams()
{
Assert.That(CompilationFinishedHook.WeaveFailed, Is.True);
Assert.That(weaverErrors, Contains.Item("Mirror.Weaver error: System.Void MirrorTest.MirrorTestPlayer::OnChangeHealth(System.Int32,System.Int32,System.Int32) should have signature:\npublic void OnChangeHealth(System.Int32 oldValue, System.Int32 newValue) { }"));
Assert.That(weaverErrors, Contains.Item("Mirror.Weaver error: System.Void MirrorTest.SyncVarsTooManyHookParams::OnChangeHealth(System.Int32,System.Int32,System.Int32) should have signature:\npublic void OnChangeHealth(System.Int32 oldValue, System.Int32 newValue) { }"));
}
[Test]
public void SyncVarsWrongHookType()
{
Assert.That(CompilationFinishedHook.WeaveFailed, Is.True);
Assert.That(weaverErrors, Contains.Item("Mirror.Weaver error: System.Void MirrorTest.MirrorTestPlayer::OnChangeHealth(System.Boolean,System.Boolean) should have signature:\npublic void OnChangeHealth(System.Int32 oldValue, System.Int32 newValue) { }"));
Assert.That(weaverErrors, Contains.Item("Mirror.Weaver error: System.Void MirrorTest.SyncVarsWrongHookType::OnChangeHealth(System.Boolean,System.Boolean) should have signature:\npublic void OnChangeHealth(System.Int32 oldValue, System.Int32 newValue) { }"));
}
[Test]
public void SyncVarsDerivedNetworkBehaviour()
{
Assert.That(CompilationFinishedHook.WeaveFailed, Is.True);
Assert.That(weaverErrors, Contains.Item("Mirror.Weaver error: Cannot generate writer for component type MirrorTest.MirrorTestPlayer/MySyncVar. Use a supported type or provide a custom writer"));
Assert.That(weaverErrors, Contains.Item("Mirror.Weaver error: Cannot generate writer for component type MirrorTest.SyncVarsDerivedNetworkBehaviour/MySyncVar. Use a supported type or provide a custom writer"));
}
[Test]
public void SyncVarsStatic()
{
Assert.That(CompilationFinishedHook.WeaveFailed, Is.True);
Assert.That(weaverErrors, Contains.Item("Mirror.Weaver error: System.Int32 MirrorTest.MirrorTestPlayer::invalidVar cannot be static"));
Assert.That(weaverErrors, Contains.Item("Mirror.Weaver error: System.Int32 MirrorTest.SyncVarsStatic::invalidVar cannot be static"));
}
[Test]
public void SyncVarsGenericParam()
{
Assert.That(CompilationFinishedHook.WeaveFailed, Is.True);
Assert.That(weaverErrors, Contains.Item("Mirror.Weaver error: Cannot generate writer for generic type MirrorTest.MirrorTestPlayer/MySyncVar`1<System.Int32>. Use a supported type or provide a custom writer"));
Assert.That(weaverErrors, Contains.Item("Mirror.Weaver error: Cannot generate writer for generic type MirrorTest.SyncVarsGenericParam/MySyncVar`1<System.Int32>. Use a supported type or provide a custom writer"));
}
[Test]
public void SyncVarsInterface()
{
Assert.That(CompilationFinishedHook.WeaveFailed, Is.True);
Assert.That(weaverErrors, Contains.Item("Mirror.Weaver error: Cannot generate writer for interface MirrorTest.MirrorTestPlayer/MySyncVar. Use a supported type or provide a custom writer"));
Assert.That(weaverErrors, Contains.Item("Mirror.Weaver error: Cannot generate writer for interface MirrorTest.SyncVarsInterface/MySyncVar. Use a supported type or provide a custom writer"));
}
[Test]
@ -78,7 +78,7 @@ public void SyncVarsDifferentModule()
public void SyncVarsCantBeArray()
{
Assert.That(CompilationFinishedHook.WeaveFailed, Is.True);
Assert.That(weaverErrors, Contains.Item("Mirror.Weaver error: System.Int32[] MirrorTest.MirrorTestPlayer::thisShouldntWork has invalid type. Use SyncLists instead of arrays"));
Assert.That(weaverErrors, Contains.Item("Mirror.Weaver error: System.Int32[] MirrorTest.SyncVarsCantBeArray::thisShouldntWork has invalid type. Use SyncLists instead of arrays"));
}
[Test]
@ -86,15 +86,15 @@ public void SyncVarsSyncList()
{
Assert.That(CompilationFinishedHook.WeaveFailed, Is.False);
Assert.That(weaverErrors, Is.Empty);
Assert.That(weaverWarnings, Contains.Item("Mirror.Weaver warning: MirrorTest.SyncObjImplementer MirrorTest.MirrorTestPlayer::syncobj has [SyncVar] attribute. SyncLists should not be marked with SyncVar"));
Assert.That(weaverWarnings, Contains.Item("Mirror.Weaver warning: Mirror.SyncListInt MirrorTest.MirrorTestPlayer::syncints has [SyncVar] attribute. SyncLists should not be marked with SyncVar"));
Assert.That(weaverWarnings, Contains.Item("Mirror.Weaver warning: MirrorTest.SyncObjImplementer MirrorTest.SyncVarsSyncList::syncobj has [SyncVar] attribute. SyncLists should not be marked with SyncVar"));
Assert.That(weaverWarnings, Contains.Item("Mirror.Weaver warning: Mirror.SyncListInt MirrorTest.SyncVarsSyncList::syncints has [SyncVar] attribute. SyncLists should not be marked with SyncVar"));
}
[Test]
public void SyncVarsMoreThan63()
{
Assert.That(CompilationFinishedHook.WeaveFailed, Is.True);
Assert.That(weaverErrors, Contains.Item("Mirror.Weaver error: MirrorTest.MirrorTestPlayer has too many SyncVars. Consider refactoring your class into multiple components"));
Assert.That(weaverErrors, Contains.Item("Mirror.Weaver error: MirrorTest.SyncVarsMoreThan63 has too many SyncVars. Consider refactoring your class into multiple components"));
}
}
}

View File

@ -4,7 +4,7 @@
namespace MirrorTest
{
class MirrorTestPlayer : NetworkBehaviour
class SyncVarsCantBeArray : NetworkBehaviour
{
[SyncVar]
int health;

View File

@ -3,7 +3,7 @@
namespace MirrorTest
{
class MirrorTestPlayer : NetworkBehaviour
class SyncVarsDerivedNetworkBehaviour : NetworkBehaviour
{
[SyncVar(hook = nameof(OnChangeHealth))]
int health;

View File

@ -3,7 +3,7 @@
namespace MirrorTest
{
class MirrorTestPlayer : NetworkBehaviour
class SyncVarsDifferentModule : NetworkBehaviour
{
[SyncVar(hook = nameof(OnChangeHealth))]
int health;

View File

@ -3,7 +3,7 @@
namespace MirrorTest
{
class MirrorTestPlayer : NetworkBehaviour
class SyncVarsGenericParam : NetworkBehaviour
{
[SyncVar(hook = nameof(OnChangeHealth))]
int health;

View File

@ -3,7 +3,7 @@
namespace MirrorTest
{
class MirrorTestPlayer : NetworkBehaviour
class SyncVarsInterface : NetworkBehaviour
{
[SyncVar(hook = nameof(OnChangeHealth))]
int health;

View File

@ -3,7 +3,7 @@
namespace MirrorTest
{
class MirrorTestPlayer : NetworkBehaviour
class SyncVarsMoreThan63 : NetworkBehaviour
{
[SyncVar(hook = nameof(OnChangeHealth))]
int health;

View File

@ -3,7 +3,7 @@
namespace MirrorTest
{
class MirrorTestPlayer : NetworkBehaviour
class SyncVarsNoHook : NetworkBehaviour
{
[SyncVar(hook = "OnChangeHealth")]
int health;

View File

@ -3,7 +3,7 @@
namespace MirrorTest
{
class MirrorTestPlayer : NetworkBehaviour
class SyncVarsNoHookParams : NetworkBehaviour
{
[SyncVar(hook = nameof(OnChangeHealth))]
int health;

View File

@ -3,7 +3,7 @@
namespace MirrorTest
{
class MirrorTestPlayer : NetworkBehaviour
class SyncVarsStatic : NetworkBehaviour
{
[SyncVar(hook = nameof(OnChangeHealth))]
int health;

View File

@ -14,7 +14,7 @@ public void OnDeserializeDelta(NetworkReader reader) {}
public void Reset() {}
}
class MirrorTestPlayer : NetworkBehaviour
class SyncVarsSyncList : NetworkBehaviour
{
[SyncVar(hook = nameof(OnChangeHealth))]
int health;

View File

@ -3,7 +3,7 @@
namespace MirrorTest
{
class MirrorTestPlayer : NetworkBehaviour
class SyncVarsTooManyHookParams : NetworkBehaviour
{
[SyncVar(hook = nameof(OnChangeHealth))]
int health;

View File

@ -3,7 +3,7 @@
namespace MirrorTest
{
class MirrorTestPlayer : NetworkBehaviour
class SyncVarsValid : NetworkBehaviour
{
[SyncVar(hook = nameof(OnChangeHealth))]
int health;

View File

@ -3,7 +3,7 @@
namespace MirrorTest
{
class MirrorTestPlayer : NetworkBehaviour
class SyncVarsWrongHookType : NetworkBehaviour
{
[SyncVar(hook = nameof(OnChangeHealth))]
int health;