public void Create_CorrectValues() { var response = new ConsulHealthResponse { Node = new Node { NodeName = "name" }, Service = new ConsulHealthService { Address = "127.0.0.2", ID = "foo", Port = 8081, Service = "bar", Tags = new[] { "tag1" } } }; var serviceResponse = ConsulServiceResponse.Create(response); serviceResponse.Node.Should().Be("name"); serviceResponse.ServiceID.Should().Be("foo"); serviceResponse.ServiceAddress.Should().Be("127.0.0.2"); serviceResponse.ServiceName.Should().Be("bar"); serviceResponse.ServicePort.Should().Be(8081); serviceResponse.ServiceTags.Should().Contain("tag1"); }
public ConsulService(ConsulServiceResponse response) { Id = response.ServiceID; Name = response.ServiceName; Tags = response.ServiceTags; Address = response.ServiceAddress; Version = response.ServiceTags.CreateVersion(); }
public ConsulService(ConsulServiceResponse response) { Id = response.ServiceID; Name = response.ServiceName; Tags = response.ServiceTags; Address = response.ServiceAddress; Version = response.ServiceTags.CreateVersion(); }
public void Create_ReturnsNull_IfServiceNull() { var response = new ConsulHealthResponse { Node = new Node() }; ConsulServiceResponse.Create(response).Should().BeNull(); }
public StaticRequestContext(string serverKey, string address) { Servers = new[] { ConsulServiceResponse.Create(new ConsulHealthResponse { Node = new Node(), Service = new ConsulHealthService { Service = serverKey, Address = address, ID = serverKey } }) }; }
public List <ConsulServiceResponse> GetServerNodeList(string name) { var result = new List <ConsulServiceResponse>(); var list = this.Entitys.Nodes.Where(r => r.ServiceFullName.Equals(name) && r.IsActive).ToList(); foreach (var server in list) { ConsulServiceResponse c = new ConsulServiceResponse { ServiceAddress = server.Url, ServiceName = name }; result.Add(c); } return(result); }
public void Create_ReturnsNull_IfNullPassed() { ConsulServiceResponse.Create(null).Should().BeNull(); }