Наследование: global::System.ComponentModel.INotifyPropertyChanged
        public override void ExecuteCmdlet()
        {
            var staticIPAddressPool = new StaticIPAddressPool()
            {
                Name = this.Name,
                VMSubnetId = this.VMSubnet.ID,
                Subnet = this.VMSubnet.Subnet,
                IPAddressRangeStart = this.IPAddressRangeStart,
                IPAddressRangeEnd = this.IPAddressRangeEnd,
                StampId = this.VMSubnet.StampId
            };

            Guid? jobId = Guid.Empty;
            var staticIPAddressPoolOperations = new StaticIPAddressPoolOperations(this.WebClientFactory);
            var createdStaticIPAddressPool = staticIPAddressPoolOperations.Create(staticIPAddressPool, out jobId);
            WaitForJobCompletion(jobId);

            var filter = new Dictionary<string, string>
            {
                {"ID", createdStaticIPAddressPool.ID.ToString()},
                {"StampId ", createdStaticIPAddressPool.StampId.ToString()}
            };
            var results = staticIPAddressPoolOperations.Read(filter);
            this.GenerateCmdletOutput(results);
        }
        public void ShouldCreateOneStaticIPAddressPool()
        {
            var mockChannel = new MockRequestChannel();

            var staticIPAddressPoolToCreate = new StaticIPAddressPool()
            {
                Name = staticIPAddressPoolName,
                VMSubnetId = Guid.Empty,
                IPAddressRangeStart = ipAddressRangeStart,
                IPAddressRangeEnd = ipAddressRangeEnd,
                StampId = Guid.Empty
            };

            var staticIPAddressPoolToReturn = new StaticIPAddressPool()
            {
                Name = staticIPAddressPoolName,
                IPAddressRangeStart = ipAddressRangeStart,
                IPAddressRangeEnd = ipAddressRangeEnd,
                StampId = Guid.Empty
            };

            mockChannel.AddReturnObject(staticIPAddressPoolToReturn, new WebHeaderCollection { "x-ms-request-id:" + Guid.NewGuid() });

            Guid? jobOut;
            var staticIPAddressPoolOperations = new StaticIPAddressPoolOperations(new WebClientFactory(new Subscription(), mockChannel));
            var createdStaticIPAddressPool = staticIPAddressPoolOperations.Create(staticIPAddressPoolToCreate, out jobOut);

            Assert.NotNull(createdStaticIPAddressPool);
            Assert.True(createdStaticIPAddressPool is StaticIPAddressPool);
            Assert.Equal(staticIPAddressPoolToReturn.Name, createdStaticIPAddressPool.Name);
            Assert.Equal(staticIPAddressPoolToReturn.VMSubnetId, createdStaticIPAddressPool.VMSubnetId);
            Assert.Equal(staticIPAddressPoolToReturn.IPAddressRangeStart, createdStaticIPAddressPool.IPAddressRangeStart);
            Assert.Equal(staticIPAddressPoolToReturn.IPAddressRangeEnd, createdStaticIPAddressPool.IPAddressRangeEnd);
            Assert.Equal(staticIPAddressPoolToReturn.StampId, createdStaticIPAddressPool.StampId);

            var requestList = mockChannel.ClientRequests;
            Assert.Equal(1, requestList.Count);
            Assert.Equal(HttpMethod.Post.ToString(), requestList[0].Item1.Method);

            // Check the URI
            Assert.Equal(baseURI, mockChannel.ClientRequests[0].Item1.Address.AbsolutePath.Substring(1));
        }
        public void ShouldReturnOneStaticIPAddressPool()
        {
            var mockChannel = new MockRequestChannel();

            var staticIPAddressPoolToCreate = new StaticIPAddressPool()
            {
                Name = staticIPAddressPoolName,
                VMSubnetId = Guid.Empty,
                IPAddressRangeStart = ipAddressRangeStart,
                IPAddressRangeEnd = ipAddressRangeEnd,
                StampId = Guid.Empty
            };
            mockChannel.AddReturnObject(staticIPAddressPoolToCreate);

            var staticIPAddressPoolOperations = new StaticIPAddressPoolOperations(new WebClientFactory(new Subscription(), mockChannel));
            var readStaticIPAddressPool = staticIPAddressPoolOperations.Read(new VMSubnet(){ StampId = Guid.Empty, ID = Guid.Empty });
            Assert.Equal(1, readStaticIPAddressPool.Count);

            // Check the URI
            var requestList = mockChannel.ClientRequests;
            Assert.Equal(1, requestList.Count);
            Assert.Equal(baseURI, mockChannel.ClientRequests[0].Item1.Address.AbsolutePath.Substring(1));
        }
        public void ShouldDeleteStaticIPAddressPool()
        {
            var mockChannel = new MockRequestChannel();

            var existingStaticIPAddressPool = new StaticIPAddressPool()
            {
                Name = staticIPAddressPoolName,
                VMSubnetId = Guid.Empty,
                IPAddressRangeStart = ipAddressRangeStart,
                IPAddressRangeEnd = ipAddressRangeEnd,
                StampId = Guid.Empty
            };
            mockChannel.AddReturnObject(new Cloud() { StampId = Guid.NewGuid() });
            mockChannel.AddReturnObject(existingStaticIPAddressPool, new WebHeaderCollection { "x-ms-request-id:" + Guid.NewGuid() });

            Guid? jobOut;
            var staticIPAddressPoolOperations = new StaticIPAddressPoolOperations(new WebClientFactory(new Subscription(), mockChannel));
            staticIPAddressPoolOperations.Delete(Guid.Empty, out jobOut);

            Assert.Equal(2, mockChannel.ClientRequests.Count);
            Assert.Equal(HttpMethod.Delete.ToString(), mockChannel.ClientRequests[1].Item1.Method);

            // Check the URI
            var requestURI = mockChannel.ClientRequests[1].Item1.Address.AbsolutePath;
            Assert.Equal("/Clouds", mockChannel.ClientRequests[0].Item1.Address.AbsolutePath.Substring(1));
            Assert.Equal(baseURI, mockChannel.ClientRequests[1].Item1.Address.AbsolutePath.Substring(1).Remove(requestURI.IndexOf('(') - 1));
        }