public async Task CanGetNetworksWithOkResponse()
        {
            var payload = @"{
                ""networks"": [
                    {
                        ""status"": ""ACTIVE"",
                        ""subnets"": [
                            ""d3839504-ec4c-47a4-b7c7-07af079a48bb""
                        ],
                        ""name"": ""myNetwork"",
                        ""router:external"": false,
                        ""tenant_id"": ""ffe683d1060449d09dac0bf9d7a371cd"",
                        ""admin_state_up"": true,
                        ""shared"": false,
                        ""id"": ""12345""
                    }
                ]
            }";

            var content = TestHelper.CreateStream(payload);

            var restResp = new HttpResponseAbstraction(content, new HttpHeadersAbstraction(), HttpStatusCode.OK);
            this.NetworkServiceRestClient.Responses.Enqueue(restResp);

            var client = new NetworkServicePocoClient(GetValidContext(), this.ServiceLocator);
            var result = await client.GetNetworks();

            Assert.IsNotNull(result);

            var networks = result.ToList();
            Assert.AreEqual(1, networks.Count());

            var network = networks.First();
            Assert.AreEqual("myNetwork", network.Name);
            Assert.AreEqual("12345", network.Id);
            Assert.AreEqual(NetworkStatus.Active, network.Status);
        }
        public async Task ExceptionthrownWhenDeletingFloatingIpAndServerError()
        {
            var restResp = new HttpResponseAbstraction(new MemoryStream(), new HttpHeadersAbstraction(), HttpStatusCode.InternalServerError);
            this.NetworkServiceRestClient.Responses.Enqueue(restResp);

            var client = new NetworkServicePocoClient(GetValidContext(), this.ServiceLocator);
            await client.DeleteFloatingIp("12345");
        }
        public async Task ExceptionthrownWhenCreatingFloatingIpAndNotAuthed()
        {
            var restResp = new HttpResponseAbstraction(new MemoryStream(), new HttpHeadersAbstraction(), HttpStatusCode.Unauthorized);
            this.NetworkServiceRestClient.Responses.Enqueue(restResp);

            var client = new NetworkServicePocoClient(GetValidContext(), this.ServiceLocator);
            await client.CreateFloatingIp("12345");
        }
        public async Task CanDeleteFloatingIpWithNoContentResponse()
        {
            
            var restResp = new HttpResponseAbstraction(new MemoryStream(), new HttpHeadersAbstraction(), HttpStatusCode.NoContent);
            this.NetworkServiceRestClient.Responses.Enqueue(restResp);

            var client = new NetworkServicePocoClient(GetValidContext(), this.ServiceLocator);
            await client.DeleteFloatingIp("12345");
        }
        public async Task CanCreateFloatingIpWithCreatedResponse()
        {
            var payload = @"{
                ""floatingip"":
                    {
                        ""router_id"": ""fafac59b-a94a-4525-8700-f4f448e0ac97"",
                        ""status"": ""ACTIVE"",
                        ""tenant_id"": ""ffe683d1060449d09dac0bf9d7a371cd"",
                        ""floating_network_id"": ""3eaab3f7-d3f2-430f-aa73-d07f39aae8f4"",
                        ""fixed_ip_address"": ""10.0.0.2"",
                        ""floating_ip_address"": ""172.0.0.1"",
                        ""port_id"": ""9da94672-6e6b-446c-9579-3dd5484b31fd"",
                        ""id"": ""12345""
                    }
            }";

            var content = TestHelper.CreateStream(payload);

            var restResp = new HttpResponseAbstraction(content, new HttpHeadersAbstraction(), HttpStatusCode.Created);
            this.NetworkServiceRestClient.Responses.Enqueue(restResp);

            var client = new NetworkServicePocoClient(GetValidContext(), this.ServiceLocator);
            var result = await client.CreateFloatingIp("12345");

            Assert.IsNotNull(result);

            Assert.AreEqual("12345", result.Id);
            Assert.AreEqual("172.0.0.1", result.FloatingIpAddress);
            Assert.AreEqual(FloatingIpStatus.Active, result.Status);
        }