Tests: remove unnecessary empty NetworkMessage serialization methods. Weaver takes care of it.

This commit is contained in:
vis2k 2020-11-10 10:27:35 +01:00
parent 2b02fa0130
commit 1ecf57a2f0
4 changed files with 0 additions and 35 deletions

View File

@ -35,43 +35,25 @@ struct StructWithEmptyMethodMessage : NetworkMessage
public int IntValue; public int IntValue;
public string StringValue; public string StringValue;
public double DoubleValue; public double DoubleValue;
// Mirror will fill out these empty methods
public void Deserialize(NetworkReader reader) { }
public void Serialize(NetworkWriter writer) { }
} }
class ClassWithoutBaseMessage : NetworkMessage class ClassWithoutBaseMessage : NetworkMessage
{ {
public int[] array; public int[] array;
// Mirror will fill out these empty methods
public void Deserialize(NetworkReader reader) { }
public void Serialize(NetworkWriter writer) { }
} }
abstract class AbstractMessage : NetworkMessage abstract class AbstractMessage : NetworkMessage
{ {
public abstract void Deserialize(NetworkReader reader);
public abstract void Serialize(NetworkWriter writer);
} }
class OverrideMessage : AbstractMessage class OverrideMessage : AbstractMessage
{ {
public int someValue; public int someValue;
// Mirror will fill out these empty methods
public override void Serialize(NetworkWriter writer) { }
public override void Deserialize(NetworkReader reader) { }
} }
class Layer1Message : NetworkMessage class Layer1Message : NetworkMessage
{ {
public int value1; public int value1;
// Mirror will fill out these empty methods
public virtual void Serialize(NetworkWriter writer) { }
public virtual void Deserialize(NetworkReader reader) { }
} }
class Layer2Message : Layer1Message class Layer2Message : Layer1Message

View File

@ -42,10 +42,6 @@ struct TestMessage2 : NetworkMessage
public string StringValue; public string StringValue;
public double DoubleValue; public double DoubleValue;
#pragma warning restore CS0649 // Field is never assigned to #pragma warning restore CS0649 // Field is never assigned to
// Mirror will fill out these empty methods
public void Deserialize(NetworkReader reader) { }
public void Serialize(NetworkWriter writer) { }
} }
public class CommandTestNetworkBehaviour : NetworkBehaviour public class CommandTestNetworkBehaviour : NetworkBehaviour

View File

@ -9,10 +9,6 @@ class NoArgMethodMessage : NetworkMessage
// Weaver should ignore these methods because they have no args // Weaver should ignore these methods because they have no args
public void Serialize() { /* method with no arg */ } public void Serialize() { /* method with no arg */ }
public void Deserialize() { /* method with no arg */ } public void Deserialize() { /* method with no arg */ }
// Mirror will fill out these empty methods
public void Serialize(NetworkWriter writer) { }
public void Deserialize(NetworkReader reader) { }
} }
class TwoArgMethodMessage : NetworkMessage class TwoArgMethodMessage : NetworkMessage
@ -22,11 +18,6 @@ class TwoArgMethodMessage : NetworkMessage
// Weaver should ignore these methods because they have two args // Weaver should ignore these methods because they have two args
public void Serialize(NetworkWriter writer, int AnotherValue) { /* method with 2 args */ } public void Serialize(NetworkWriter writer, int AnotherValue) { /* method with 2 args */ }
public void Deserialize(NetworkReader reader, int AnotherValue) { /* method with 2 args */ } public void Deserialize(NetworkReader reader, int AnotherValue) { /* method with 2 args */ }
// Mirror will fill out these empty methods
public void Serialize(NetworkWriter writer) { }
public void Deserialize(NetworkReader reader) { }
} }
public class OverloadMethodTest public class OverloadMethodTest

View File

@ -5,10 +5,6 @@ namespace Mirror.Tests.StructMessages
public struct SomeStructMessage : NetworkMessage public struct SomeStructMessage : NetworkMessage
{ {
public int someValue; public int someValue;
// Mirror will automatically implement message that are empty
public void Serialize(NetworkWriter writer) { }
public void Deserialize(NetworkReader reader) { }
} }
[TestFixture] [TestFixture]