public void TestFindServices6() { var payload = Encoding.UTF8.GetBytes("Version 5, Protocol 120"); using (var registry = new NetworkServiceDiscoverer(sendLegacyResponse: true)) using (registry.RegisterService("MyAwesomeWebApplication", new IPEndPoint(IPAddress.Parse("19.87.0.12"), port: 15431), payload)) { var services = _discoverer.FindServices("MyAwesomeWebApplication"); services.Should().NotBeNull(); services.Should().NotBeEmpty(); foreach (var service in services) { service.Name.Should().Be("MyAwesomeWebApplication"); service.Payload.Should().Equal(payload); } } }
public void TestRegisterTooBig() { new Action(() => _discoverer.RegisterService("dawwdawd", new IPEndPoint(IPAddress.Any, 0), new byte[500])) .ShouldThrow <ArgumentOutOfRangeException>() .WithMessage("The total size of a message may not exceed 512 bytes (this message would be 568 bytes in length)\r\nParameter name: payload"); }