public void TestSuccessGenerateWhenOnePort() { var httpMockPortGenerator = new HttpMockPortGenerator(unanavailablePortsProvider.Object, 1, 1); var expectedPort = httpMockPortGenerator.GeneratePort(); expectedPort.ShouldBeEquivalentTo(1); }
public void TestFailGenerateWhenOnePort() { var httpMockPortGenerator = new HttpMockPortGenerator(unanavailablePortsProvider.Object, 1, 1); var expectedPort = httpMockPortGenerator.GeneratePort(); expectedPort.ShouldBeEquivalentTo(1); httpMockPortGenerator.Invoking(g => g.GeneratePort()).ShouldThrow <Exception>(); }
public void TestSuccessGenerate() { var httpMockPortGenerator = new HttpMockPortGenerator(unanavailablePortsProvider.Object); var hashSet = new HashSet <int>(); for (var i = 0; i < 10000; i++) { var port = httpMockPortGenerator.GeneratePort(); hashSet.Contains(port).ShouldBeEquivalentTo(false); hashSet.Add(port); } }