Exemple #1
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);
        }
Exemple #2
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);
        }