public void CreateProtobufConnection_ShouldCreateWithProperDependencies( [Frozen] IProtobufFieldNumberCache cache, [Frozen] IProtobufStreamSerializer protobuf, [Frozen] IMessageSerializer serializer, [Frozen] IMessageTypeCache messageTypeCache, [Frozen] IMessageMetadataFactory metadataFactory, Stream stream, ProtobufConnectionFactory sut) { var connection = sut.CreateProtobufConnection(stream); Assert.IsType <MessageSerializerConnection>(connection); Assert.Equal(serializer, GetPrivateField(connection, "_serializer")); Assert.Equal(messageTypeCache, GetPrivateField(connection, "_messageTypeCache")); Assert.Equal(metadataFactory, GetPrivateField(connection, "_metadataFactory")); var rawConnection = GetPrivateField(connection, "_connection") !; Assert.NotNull(rawConnection); Assert.IsType <ProtobufConnection>(rawConnection); Assert.Equal(cache, GetPrivateField(rawConnection, "_fieldNumberCache")); Assert.Equal(stream, GetPrivateField(rawConnection, "_stream")); Assert.Equal(protobuf, GetPrivateField(rawConnection, "_protobuf")); }
public async Task ShouldCreateWithStreamAndCache( [Frozen] IProtobufFieldNumberCache cache, [Frozen] IProtobuf protobuf, Stream stream, ProtobufConnectionFactory sut) { var connection = sut.CreateProtobufConnection(stream); Assert.Equal(cache, GetPrivateField(connection, "_fieldNumberCache")); Assert.Equal(stream, GetPrivateField(connection, "_stream")); Assert.Equal(protobuf, GetPrivateField(connection, "_protobuf")); }