mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Test improved
This commit is contained in:
parent
304f2b6f53
commit
91f2c19c2d
@ -131,19 +131,17 @@ public void Hook_CalledWhenSyncingChangedValue(bool intialState)
|
|||||||
out _, out _, out HookBehaviour serverObject,
|
out _, out _, out HookBehaviour serverObject,
|
||||||
out _, out _, out HookBehaviour clientObject);
|
out _, out _, out HookBehaviour clientObject);
|
||||||
|
|
||||||
const int clientValue = 10;
|
|
||||||
const int serverValue = 24;
|
const int serverValue = 24;
|
||||||
|
|
||||||
// change it on server
|
// change it on server
|
||||||
serverObject.value = serverValue;
|
serverObject.value = serverValue;
|
||||||
clientObject.value = clientValue;
|
|
||||||
|
|
||||||
// hook should change it on client
|
// hook should change it on client
|
||||||
int callCount = 0;
|
int callCount = 0;
|
||||||
clientObject.HookCalled += (oldValue, newValue) =>
|
clientObject.HookCalled += (oldValue, newValue) =>
|
||||||
{
|
{
|
||||||
callCount++;
|
callCount++;
|
||||||
Assert.That(oldValue, Is.EqualTo(clientValue));
|
Assert.That(oldValue, Is.EqualTo(0));
|
||||||
Assert.That(newValue, Is.EqualTo(serverValue));
|
Assert.That(newValue, Is.EqualTo(serverValue));
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -215,19 +213,17 @@ public void StaticMethod_HookCalledWhenSyncingChangedValue(bool intialState)
|
|||||||
out _, out _, out StaticHookBehaviour serverObject,
|
out _, out _, out StaticHookBehaviour serverObject,
|
||||||
out _, out _, out StaticHookBehaviour clientObject);
|
out _, out _, out StaticHookBehaviour clientObject);
|
||||||
|
|
||||||
const int clientValue = 10;
|
|
||||||
const int serverValue = 24;
|
const int serverValue = 24;
|
||||||
|
|
||||||
// change it on server
|
// change it on server
|
||||||
serverObject.value = serverValue;
|
serverObject.value = serverValue;
|
||||||
clientObject.value = clientValue;
|
|
||||||
|
|
||||||
// hook should change it on client
|
// hook should change it on client
|
||||||
int hookcallCount = 0;
|
int hookcallCount = 0;
|
||||||
StaticHookBehaviour.HookCalled += (oldValue, newValue) =>
|
StaticHookBehaviour.HookCalled += (oldValue, newValue) =>
|
||||||
{
|
{
|
||||||
hookcallCount++;
|
hookcallCount++;
|
||||||
Assert.That(oldValue, Is.EqualTo(clientValue));
|
Assert.That(oldValue, Is.EqualTo(0));
|
||||||
Assert.That(newValue, Is.EqualTo(serverValue));
|
Assert.That(newValue, Is.EqualTo(serverValue));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user