public void Pool_List3InterleavedSources() { var p = new EntropyPool(); var s1 = new NullSource(); var s2 = new NullSource(); var s3 = new NullSource(); var e1 = new EntropyEvent(_Zero16Bytes, s1); var e2 = new EntropyEvent(_Zero16Bytes, s2); var e3 = new EntropyEvent(_Zero16Bytes, s3); using (var sw = new StreamWriter("pool_3interleaved.txt", false, Encoding.UTF8)) { sw.WriteLine($"Total: Source 1 : Source 2 : Source 3"); for (int i = 0; i < 10000; i++) { if (i % 3 == 0) { p.Add(e1); } else if (i % 3 == 1) { p.Add(e2); } else { p.Add(e3); } var counts = p.GetCountOfBytesBySource(); if (counts.Count == 3) { sw.WriteLine($"{p.EntropyBytesSinceLastDigest} :{counts[s1]:N0} :{counts[s2]:N0} :{counts[s3]:N0}"); } } } }
public void NullSource_IsNull() { var source = new NullSource(); var result = source.GetEntropyAsync(EntropyPriority.Normal).GetAwaiter().GetResult(); Assert.IsTrue(result.All(b => b == 0)); }
public async Task SmokeTest() { var executorFactory = new AsyncEndpointExecutorFactory(TestConstants.DefaultConfig, TestConstants.DefaultOptions); Router router = await Router.CreateAsync("router1", "hub", new RouterConfig(new HashSet <Endpoint>(), new HashSet <Route>(), Option.None <Route>()), executorFactory); var source = new NullSource(router); Task result = source.CloseAsync(CancellationToken.None); Assert.True(result.IsCompleted); }
public void TransformWithTypeDoesNotThrowIfReturnsNull() { var dummy = new NullSource(); Node node = new Node("mytest", dummy); Assert.That( () => node.TransformWith(typeof(NullConverter)), Throws.Nothing); Assert.That(node.Format, Is.Null); }
public void TransformWithInitDoesNotThrowIfReturnsNull() { var dummy = new NullSource(); using Node node = new Node("mytest", dummy); Assert.That( () => node.TransformWith <NullConverter, int>(2), Throws.Nothing); Assert.That(node.Format, Is.Null); }
public void TransformToWithTypeDoesNotThrowIfReturnsNull() { var dummy = new NullSource(); using Node node = new Node("mytest", dummy); Assert.That( () => node.TransformTo(typeof(NullDestination)), Throws.Nothing); Assert.That(node.Format, Is.Null); }