Exemplo n.º 1
0
        /// <summary>
        /// Remove a Droplet from a Cloud Firewall,
        /// </summary>
        public Task RemoveDroplets(string firewallId, Models.Requests.FirewallDroplets droplets)
        {
            var parameters = new List <Parameter> {
                new Parameter("id", firewallId, ParameterType.UrlSegment)
            };

            return(_connection.ExecuteRaw("firewalls/{id}/droplets", parameters, droplets, Method.DELETE));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Assign a Droplet to a Cloud Firewall
        /// </summary>
        public Task AddDroplets(string firewallId, Models.Requests.FirewallDroplets droplets)
        {
            var parameters = new List <Parameter> {
                new Parameter {
                    Name = "id", Value = firewallId, Type = ParameterType.UrlSegment
                }
            };

            return(_connection.ExecuteRaw("firewalls/{id}/droplets", parameters, droplets, Method.POST));
        }
        public void CorrectRequestForRemoveDroplets()
        {
            var factory  = Substitute.For <IConnection>();
            var client   = new FirewallsClient(factory);
            var droplets = new Models.Requests.FirewallDroplets {
                DropletIds = new List <long> {
                    1, 2, 3, 4
                }
            };

            client.RemoveDroplets("1", droplets);
            var parameters = Arg.Is <List <Parameter> >(list => (string)list[0].Value == "1");

            factory.Received().ExecuteRaw("firewalls/{id}/droplets", parameters, droplets, Method.DELETE);
        }