Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSerializeDynamicRecordsRemoved() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldSerializeDynamicRecordsRemoved()
        {
            _channel.reset();
            // Given
            NodeRecord before = new NodeRecord(12, false, 1, 2);

            before.InUse = true;
            IList <DynamicRecord> beforeDyn = singletonList(dynamicRecord(0, true, true, -1L, LONG.intValue(), new sbyte[] { 1, 2, 3, 4, 5, 6, 7, 8 }));

            before.SetLabelField(dynamicPointer(beforeDyn), beforeDyn);
            NodeRecord after = new NodeRecord(12, false, 2, 1);

            after.InUse = true;
            IList <DynamicRecord> dynamicRecords = singletonList(dynamicRecord(0, false, true, -1L, LONG.intValue(), new sbyte[] { 1, 2, 3, 4, 5, 6, 7, 8 }));

            after.SetLabelField(dynamicPointer(dynamicRecords), dynamicRecords);
            // When
            Command.NodeCommand cmd = new Command.NodeCommand(before, after);
            cmd.Serialize(_channel);
            Command.NodeCommand result = (Command.NodeCommand)_commandReader.read(_channel);
            // Then
            assertThat(result, equalTo(cmd));
            assertThat(result.Mode, equalTo(cmd.Mode));
            assertThat(result.Before, equalTo(cmd.Before));
            assertThat(result.After, equalTo(cmd.After));
            // And dynamic records should be the same
            assertThat(result.Before.DynamicLabelRecords, equalTo(cmd.Before.DynamicLabelRecords));
            assertThat(result.After.DynamicLabelRecords, equalTo(cmd.After.DynamicLabelRecords));
        }