public void GenerateUniqueId() { const int iterations = 10; var ids = new HashSet <string>(); var generator = new RequestIdGenerator(); for (var i = 0; i < iterations; ++i) { ids.Add(generator.GenerateUniqueId()); } Assert.Equal(iterations, ids.Count); }
public void RequestIdsAreUnique() { var idGenerator = new RequestIdGenerator(); var generatedIds = new List <int>(); for (int i = 0; i < 5; i++) { var id = idGenerator.CreateId(); Console.WriteLine(id); Assert.IsFalse(generatedIds.Contains(id)); generatedIds.Add(id); Task.Delay(1000); } }
public RequestIdFilter(RequestIdGenerator requestIdGenerator) { this.requestIdGenerator = requestIdGenerator; }