Exemple #1
0
        public override void ExecuteCmdlet()
        {
            IEnumerable <LogicalNetwork> results = null;
            var logicalNetworkOperations         = new LogicalNetworkOperations(this.WebClientFactory);

            if (this.ParameterSetName == WAPackCmdletParameterSets.Empty)
            {
                results = logicalNetworkOperations.Read();
            }
            else if (this.ParameterSetName == WAPackCmdletParameterSets.FromName)
            {
                results = logicalNetworkOperations.Read(Name);
            }

            this.GenerateCmdletOutput(results);
        }
        public override void ExecuteCmdlet()
        {
            IEnumerable<LogicalNetwork> results = null;
            var logicalNetworkOperations = new LogicalNetworkOperations(this.WebClientFactory);

            if (this.ParameterSetName == WAPackCmdletParameterSets.Empty)
            {
                results = logicalNetworkOperations.Read();
            }
            else if (this.ParameterSetName == WAPackCmdletParameterSets.FromName)
            {
                results = logicalNetworkOperations.Read(Name);
            }

            this.GenerateCmdletOutput(results);
        }
        public void ShouldReturnOneLogicalNetwork()
        {
            var mockChannel = new MockRequestChannel();
            mockChannel.AddReturnObject(new LogicalNetwork { ID = Guid.Empty, CloudId = Guid.Empty, Name = logicalNetworkName });

            var logicalNetworkOperations = new LogicalNetworkOperations(new WebClientFactory(new Subscription(), mockChannel));
            Assert.AreEqual(1, logicalNetworkOperations.Read().Count);
        }
Exemple #4
0
        public void ShouldReturnOneLogicalNetwork()
        {
            var mockChannel = new MockRequestChannel();

            mockChannel.AddReturnObject(new LogicalNetwork {
                ID = Guid.Empty, CloudId = Guid.Empty, Name = logicalNetworkName
            });

            var logicalNetworkOperations = new LogicalNetworkOperations(new WebClientFactory(new Subscription(), mockChannel));

            Assert.Equal(1, logicalNetworkOperations.Read().Count);
        }
        public void ShouldReturnMultipleLogicalNetworks()
        {
            var mockChannel = new MockRequestChannel();
            var logicalNetworks = new List<object>
            {
                new LogicalNetwork { ID = Guid.Empty, CloudId = Guid.Empty, Name = logicalNetworkName },
                new LogicalNetwork { ID = Guid.Empty, CloudId = Guid.Empty, Name = logicalNetworkName }
            };
            mockChannel.AddReturnObject(logicalNetworks);

            var logicalNetworkOperations = new LogicalNetworkOperations(new WebClientFactory(new Subscription(), mockChannel));
            var logicalNetworkList = logicalNetworkOperations.Read();

            Assert.AreEqual(2, logicalNetworkList.Count);
            Assert.IsTrue(logicalNetworkList.All(logicalNetwork => logicalNetwork.Name == logicalNetworkName));
        }
Exemple #6
0
        public void ShouldReturnMultipleLogicalNetworks()
        {
            var mockChannel     = new MockRequestChannel();
            var logicalNetworks = new List <object>
            {
                new LogicalNetwork {
                    ID = Guid.Empty, CloudId = Guid.Empty, Name = logicalNetworkName
                },
                new LogicalNetwork {
                    ID = Guid.Empty, CloudId = Guid.Empty, Name = logicalNetworkName
                }
            };

            mockChannel.AddReturnObject(logicalNetworks);

            var logicalNetworkOperations = new LogicalNetworkOperations(new WebClientFactory(new Subscription(), mockChannel));
            var logicalNetworkList       = logicalNetworkOperations.Read();

            Assert.Equal(2, logicalNetworkList.Count);
            Assert.True(logicalNetworkList.All(logicalNetwork => logicalNetwork.Name == logicalNetworkName));
        }
Exemple #7
0
        public void ShouldReturnEmptyOnNoResult()
        {
            var logicalNetworkOperations = new LogicalNetworkOperations(new WebClientFactory(new Subscription(), MockRequestChannel.Create()));

            Assert.False(logicalNetworkOperations.Read().Any());
        }
 public void ShouldReturnEmptyOnNoResult()
 {
     var logicalNetworkOperations = new LogicalNetworkOperations(new WebClientFactory(new Subscription(), MockRequestChannel.Create()));
     Assert.IsFalse(logicalNetworkOperations.Read().Any());
 }