コード例 #1
0
        public void TestOnSendZeroCountEvent()
        {
            Action <NetworkDiagnostics.MessageInfo> outMessageCallback = Substitute.For <Action <NetworkDiagnostics.MessageInfo> >();

            NetworkDiagnostics.OutMessageEvent += outMessageCallback;

            var message = new TestMessage();

            NetworkDiagnostics.OnSend(message, Channel.Reliable, 10, 0);
            outMessageCallback.DidNotReceive();

            NetworkDiagnostics.OutMessageEvent -= outMessageCallback;
        }
コード例 #2
0
        public void TestOnSendEvent()
        {
            Action <NetworkDiagnostics.MessageInfo> outMessageCallback = Substitute.For <Action <NetworkDiagnostics.MessageInfo> >();

            NetworkDiagnostics.OutMessageEvent += outMessageCallback;

            var message = new TestMessage();

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

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

            NetworkDiagnostics.OutMessageEvent -= outMessageCallback;
        }