예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldDecodeAckFailure() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldDecodeAckFailure()
        {
            Neo4jPackV1 neo4jPack       = new Neo4jPackV1();
            InitMessage originalMessage = new InitMessage("My Driver", map("user", "neo4j", "password", "secret"));

            PackedInputArray   innput   = new PackedInputArray(serialize(neo4jPack, originalMessage));
            Neo4jPack_Unpacker unpacker = neo4jPack.NewUnpacker(innput);

            // these two steps are executed before decoding in order to select a correct decoder
            unpacker.UnpackStructHeader();
            unpacker.UnpackStructSignature();

            RequestMessage deserializedMessage = _decoder.decode(unpacker);

            assertEquals(originalMessage, deserializedMessage);
        }
예제 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected void testShouldDecodeAuthToken(java.util.Map<String,Object> authToken, boolean checkDecodingResult) throws Exception
        protected internal override void TestShouldDecodeAuthToken(IDictionary <string, object> authToken, bool checkDecodingResult)
        {
            Neo4jPack neo4jPack = newNeo4jPack();

            authToken["user_agent"] = "My Driver";
            HelloMessage originalMessage = new HelloMessage(authToken);

            PackedInputArray input = new PackedInputArray(encode(neo4jPack, originalMessage));

            Org.Neo4j.Bolt.messaging.Neo4jPack_Unpacker unpacker = neo4jPack.NewUnpacker(input);

            // these two steps are executed before decoding in order to select a correct decoder
            unpacker.UnpackStructHeader();
            unpacker.UnpackStructSignature();

            RequestMessage deserializedMessage = _decoder.decode(unpacker);

            if (checkDecodingResult)
            {
                AssertHelloMessageMatches(originalMessage, deserializedMessage);
            }
        }