public void GetsAzureEnvironments()
        {
            Mock<ICommandRuntime> commandRuntimeMock = new Mock<ICommandRuntime>();
            GetAzureEnvironmentCommand cmdlet = new GetAzureEnvironmentCommand()
            {
                CommandRuntime = commandRuntimeMock.Object
            };

            cmdlet.ExecuteCmdlet();

            commandRuntimeMock.Verify(
                f => f.WriteObject(It.IsAny<List<PSObject>>(), true),
                Times.Once());
        }
예제 #2
0
        public void GetsAzureEnvironments()
        {
            Mock <ICommandRuntime>     commandRuntimeMock = new Mock <ICommandRuntime>();
            GetAzureEnvironmentCommand cmdlet             = new GetAzureEnvironmentCommand()
            {
                CommandRuntime = commandRuntimeMock.Object
            };

            cmdlet.ExecuteCmdlet();

            commandRuntimeMock.Verify(
                f => f.WriteObject(It.IsAny <List <PSObject> >(), true),
                Times.Once());
        }
        public void GetsAzureEnvironment()
        {
            Mock<ICommandRuntime> commandRuntimeMock = new Mock<ICommandRuntime>();
            GetAzureEnvironmentCommand cmdlet = new GetAzureEnvironmentCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                Name = EnvironmentName.AzureChinaCloud
            };

            cmdlet.ExecuteCmdlet();

            commandRuntimeMock.Verify(
                f => f.WriteObject(It.IsAny<WindowsAzureEnvironment>()),
                Times.Once());
        }
예제 #4
0
        public void GetsAzureEnvironment()
        {
            Mock <ICommandRuntime>     commandRuntimeMock = new Mock <ICommandRuntime>();
            GetAzureEnvironmentCommand cmdlet             = new GetAzureEnvironmentCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                Name           = EnvironmentName.AzureChinaCloud
            };

            cmdlet.ExecuteCmdlet();

            commandRuntimeMock.Verify(
                f => f.WriteObject(It.IsAny <WindowsAzureEnvironment>()),
                Times.Once());
        }
예제 #5
0
        public void GetsAzureEnvironments()
        {
            List <PSObject>        environments       = null;
            Mock <ICommandRuntime> commandRuntimeMock = new Mock <ICommandRuntime>();

            commandRuntimeMock.Setup(c => c.WriteObject(It.IsAny <object>(), It.IsAny <bool>()))
            .Callback <object, bool>((e, _) => environments = (List <PSObject>)e);

            GetAzureEnvironmentCommand cmdlet = new GetAzureEnvironmentCommand()
            {
                CommandRuntime = commandRuntimeMock.Object
            };

            cmdlet.InvokeBeginProcessing();
            cmdlet.ExecuteCmdlet();
            cmdlet.InvokeEndProcessing();

            Assert.Equal(2, environments.Count);
        }
예제 #6
0
        public void GetsAzureEnvironment()
        {
            List <PSAzureEnvironment> environments       = null;
            Mock <ICommandRuntime>    commandRuntimeMock = new Mock <ICommandRuntime>();

            commandRuntimeMock.Setup(c => c.WriteObject(It.IsAny <object>(), It.IsAny <bool>()))
            .Callback <object, bool>((e, _) => environments = (List <PSAzureEnvironment>)e);

            GetAzureEnvironmentCommand cmdlet = new GetAzureEnvironmentCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                Name           = EnvironmentName.AzureChinaCloud
            };

            AzureSMCmdlet.CurrentProfile = new AzureSMProfile();
            cmdlet.InvokeBeginProcessing();
            cmdlet.ExecuteCmdlet();
            cmdlet.InvokeEndProcessing();

            Assert.Equal(1, environments.Count);
        }