Exemplo n.º 1
0
        public void GetServerAddress()
        {
            using (var httpTest = new HttpTest())
            {
                Identifier serverId = Guid.NewGuid();
                httpTest.RespondWithJson(new ServerCollection {
                    new Server {
                        Id = serverId
                    }
                });
                httpTest.RespondWithJson(new Dictionary <string, IList <ServerAddress> >
                {
                    ["private"] = new List <ServerAddress>
                    {
                        new ServerAddress {
                            IP = "1.2.3.4"
                        }
                    }
                });

                var serverReferences = _compute.ListServerSummaries();
                var result           = (serverReferences.First().GetAddress("private")).First();

                httpTest.ShouldHaveCalled($"*/servers/{serverId}/ips/private");
                Assert.NotNull(result);
                Assert.Equal("1.2.3.4", result.IP);
            }
        }
Exemplo n.º 2
0
 public void SerializeListServerOptionsInUrl()
 {
     using (var httpTest = new HttpTest())
     {
         httpTest.RespondWithJson(new ServerSummaryCollection());
         _compute.ListServerSummaries(new ServerListOptions());
         httpTest.ShouldNotHaveCalled("*metadata*");
     }
 }