Beispiel #1
0
            public async void WritesRunMessageCorrectly()
            {
                var mocks  = new WriterTests.Mocks();
                var writer = new BoltWriter(mocks.OutputStream);

                writer.Write(new RunMessage("RETURN 1 AS num"));
                await writer.FlushAsync();

                mocks.VerifyResult("00 13 b2 10 8f 52 45 54 55 52 4e 20 31 20 41 53 20 6e 75 6d a0 00 00");
            }
Beispiel #2
0
            public async void WritesAckFailureMessageCorrectly()
            {
                var mocks  = new WriterTests.Mocks();
                var writer = new BoltWriter(mocks.OutputStream);

                writer.Write(new AckFailureMessage());
                await writer.FlushAsync();

                mocks.VerifyResult("00 02 B0 0E 00 00");
            }
Beispiel #3
0
            public async void WritesInitMessageCorrectly()
            {
                var mocks  = new WriterTests.Mocks();
                var writer = new BoltWriter(mocks.OutputStream);

                writer.Write(new InitMessage("a", new Dictionary <string, object>()));
                await writer.FlushAsync();

                mocks.VerifyResult("00 05 B2 01 81 61 A0 00 00");
            }
Beispiel #4
0
        public async void ShouldWriteToStreamWhenFlushedAsync()
        {
            var stream = new MemoryStream();
            var writer = new BoltWriter(stream, CreatePackStreamFactory());

            writer.Write(new RunMessage("RETURN $x", new Dictionary <string, object> {
                { "x", 1L }
            }));

            await writer.FlushAsync();

            Assert.NotEmpty(stream.ToArray());
        }
Beispiel #5
0
            public async void WritesRunMessageWithArrayParamCorrectly()
            {
                var mocks  = new WriterTests.Mocks();
                var writer = new BoltWriter(mocks.OutputStream);

                var values = new Dictionary <string, object> {
                    { "value", new[] { 1, 2 } }
                };

                writer.Write(new RunMessage("", values));
                await writer.FlushAsync();

                mocks.VerifyResult("00 0D B2 10 80 A1 85 76 61 6C 75 65 92 01 02 00 00");
            }
Beispiel #6
0
            public async void WritesRunMessageWithStringParamCorrectly(string value, string expectedBytes)
            {
                var mocks  = new WriterTests.Mocks();
                var writer = new BoltWriter(mocks.OutputStream);

                var values = new Dictionary <string, object> {
                    { "value", value }
                };

                writer.Write(new RunMessage("", values));
                await writer.FlushAsync();

                mocks.VerifyResult(expectedBytes);
            }
Beispiel #7
0
            public async void WritesRunMessageWithDictionaryParamCorrectly()
            {
                var mocks  = new WriterTests.Mocks();
                var writer = new BoltWriter(mocks.OutputStream);

                var values = new Dictionary <string, object>
                {
                    { "value", new Dictionary <string, object> {
                          { "key1", 1 }, { "key2", 2 }
                      } }
                };

                writer.Write(new RunMessage("", values));
                await writer.FlushAsync();

                mocks.VerifyResult("00 17 B2 10 80 A1 85 76 61 6C 75 65 A2 84 6B 65 79 31 01 84 6B 65 79 32 02 00 00");
            }