public void Initialize()
 {
     var azureSub = new WindowsAzureSubscription();
     azureSub.ServiceEndpoint = new Uri("https://localhost:8090/");
     azureSub.SubscriptionId = Guid.NewGuid().ToString();
     this.subscription = new Subscription(azureSub);
 }
        public void Initialize()
        {
            this.channel = MockRequestChannel.Create();

            var subscription = new Subscription
            {
                ServiceEndpoint = new Uri("http://localhost:8090/"),
                SubscriptionId = Guid.NewGuid().ToString(),
            };
            
            this.client = new WAPackIaaSClient(subscription, channel);
        }
        public void DeleteVM()
        {
            var sub = new Subscription();
            var channel = new MockRequestChannel();

            //Response to client getting /Clouds (client needs stampId, gets it from clouds)
            var testCloud = new Cloud { ID = Guid.NewGuid(), StampId = Guid.NewGuid() };
            channel.AddReturnObject(testCloud);

            //Response to the DELETE
            channel.AddReturnObject(null, new WebHeaderCollection {"x-ms-request-id:" + Guid.NewGuid()});

            var vmOps = new VirtualMachineOperations(new WebClientFactory(sub, channel));

            Guid toDelete = Guid.NewGuid();
            Guid? jobOut;

            vmOps.Delete(toDelete, out jobOut);

            //Check the requests the client generated
            Assert.AreEqual(channel.ClientRequests.Count, 2);
            Assert.AreEqual(channel.ClientRequests[1].Item1.Method, HttpMethod.Delete.ToString());
        }
        public void VmCreateShouldThrowIfNoVhdAndNoTemplateSupplied()
        {
            var channel = new MockRequestChannel();
            var testCloud = new Cloud { ID = Guid.NewGuid(), StampId = Guid.NewGuid() };
            channel.AddReturnObject(testCloud);

            var sub = new Subscription();
            var vmOps = new VirtualMachineOperations(new WebClientFactory(sub, channel));

            var vmToCreate = new VirtualMachine {Name = "Test"};

            Guid? jobOut;
            vmOps.Create(vmToCreate, out jobOut);
        }
 public GetAbsoluteUriTests()
 {
     var azureSub = new AzureSubscription();
     azureSub.Id = Guid.NewGuid();
     this.subscription = new Subscription(azureSub);
 }
 public WebClientFactory(Subscription subscription, IRequestChannel channel)
 {
     this.subscription = subscription;
     this.channel = channel;
 }