public void Indexer_ShouldReturnDefaultValue_ForSilentChannel_UsingValidIndex() { // Arrange. var collection = new Int32[] { 3, 4, 5, 6, 7 }; var target = new ObjectCollectionChannel <Int32>(collection); var index = 2; target.Toggle(); // Act. var result = target[index]; // Assert. result.Should().Be(default(Int32)); }
public void ReadAsync_ShouldReturnDefaultValue_ForSilentChannel_WithoutSampleRange_UsingValidIndex() { // Arrange. var collection = new Int32[] { 3, 4, 5, 6, 7 }; var target = new ObjectCollectionChannel <Int32>(collection); var index = 2; target.Toggle(); // Act. var task = target.ReadAsync(index); task.Wait(); var result = task.Result; // Assert. result.ChannelReadIndex.Should().Be(index); result.Value.Should().Be(default(Int32)); }
public void ReadAsync_ShouldReturnDefaultValues_ForSilentChannel_WithSampleRange_UsingValidSampleRange() { // Arrange. var collection = new Int32[] { 3, 4, 5, 6, 7 }; var target = new ObjectCollectionChannel <Int32>(collection); var index = 2; var lookBehindLength = 2; var lookAheadLength = 2; target.Toggle(); // Act. var task = target.ReadAsync(index, lookBehindLength, lookAheadLength); task.Wait(); var result = task.Result; // Assert. result.UnitOfOutput.ChannelReadIndex.Should().Be(index); result.UnitOfOutput.Value.Should().Be(default(Int32)); result.LookBehindRange.Should().HaveCount(0); result.LookAheadRange.Should().HaveCount(0); }