//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldToStringBothUsedAndUnusedDynamicLabelRecords() public virtual void ShouldToStringBothUsedAndUnusedDynamicLabelRecords() { // GIVEN IdSequence ids = mock(typeof(IdSequence)); when(ids.NextId()).thenReturn(1L, 2L); ReusableRecordsAllocator recordAllocator = new ReusableRecordsAllocator(30, new DynamicRecord(1), new DynamicRecord(2)); NodeRecord node = NewUsedNodeRecord(0); long labelId = 10_123; // A dynamic label record ICollection <DynamicRecord> existing = allocateRecordsForDynamicLabels(node.Id, new long[] { labelId }, recordAllocator); // and a deleted one as well (simulating some deleted labels) DynamicRecord unused = NewDeletedDynamicRecord(ids.NextId()); unused.InUse = false; existing.Add(unused); node.SetLabelField(dynamicPointer(existing), existing); // WHEN string toString = node.ToString(); // THEN assertThat(toString, containsString(labelId.ToString())); assertThat(toString, containsString(unused.ToString())); }
public void Should_be_sequential() { var id = _idSequence.NextId(); var last = id; for (var i = 0; i < 100; i++) { id = _idSequence.NextId(); Assert.AreEqual(last + 1, id); last = id; } }
public override void Send(Message message) { if (message.Id == 0) { message.Id = _idSequence.NextId(); } if (message.IsConfirmable) { var transaction = _transmissionContextFactory.Create(this, message); _retransmissions.Add(message.Id, transaction); transaction.ScheduleRetry(RetryCallback, ErrorCallback); } else if (message.IsReply) { _replyCache.Add(message); } SendMessageOverLowerLayer(message); }