public void TestOnReceiveEvent()
        {
            Action <NetworkDiagnostics.MessageInfo> outMessageCallback = Substitute.For <Action <NetworkDiagnostics.MessageInfo> >();

            NetworkDiagnostics.InMessageEvent += outMessageCallback;

            var message = new TestMessage();

            NetworkDiagnostics.OnReceive(message, Channel.Reliable, 10);
            var expected = new NetworkDiagnostics.MessageInfo(message, Channel.Reliable, 10, 1);

            outMessageCallback.Received(1).Invoke(Arg.Is(expected));

            NetworkDiagnostics.InMessageEvent -= outMessageCallback;
        }
Ejemplo n.º 2
0
        public void TestOnSendEvent()
        {
            var outMessageCallback = Substitute.For <Action <NetworkDiagnostics.MessageInfo> >();

            NetworkDiagnostics.OutMessageEvent += outMessageCallback;

            var message = new TestMessage();

            NetworkDiagnostics.OnSend(message, 10, 5);
            var expected = new NetworkDiagnostics.MessageInfo(message, 10, 5);

            outMessageCallback.Received(1).Invoke(Arg.Is(expected));

            NetworkDiagnostics.OutMessageEvent -= outMessageCallback;
        }
Ejemplo n.º 3
0
 public void output(NetworkDiagnostics.MessageInfo info)
 {
     thisSecondOut += info.bytes * info.count;
 }
Ejemplo n.º 4
0
 public void input(NetworkDiagnostics.MessageInfo info)
 {
     thisSecondIn += info.bytes;
 }