public MessageSenderTests()
        {
            stream     = new NetworkMemoryStream();
            serializer = A.Fake <IMessageSerializer>();
            A.CallTo(() => serializer.Serialize(null)).WithAnyArguments().Returns(new byte[0]);

            sender = new MessagesSender(serializer);
        }
Beispiel #2
0
        public MessageStreamReaderTests()
        {
            stream = A.Fake <NetworkMemoryStream>(o => o.CallsBaseMethods());

            deserializer    = A.Fake <IMessageDeserializer>();
            preparedMessage = A.Fake <IMessage>();

            A.CallTo(() => deserializer.Deserialize(null, 0, 0))
            .WhenArgumentsMatch(FirstMessage)
            .Returns(preparedMessage);

            parser = new MessageStreamReader(deserializer, stream);
        }
        public ServerMessageStreamReaderTests()
        {
            deserializer = A.Fake <IMessageDeserializer>();
            stream       = A.Fake <NetworkMemoryStream>(o => o.CallsBaseMethods());

            preparedMessage = A.Fake <IMessage>();

            A.CallTo(() => deserializer.Deserialize(null, 0, 0))
            .WithAnyArguments()
            .Returns(preparedMessage);

            streamReader = new ServerMessageStreamReader(stream, deserializer);
        }