コード例 #1
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());
        }
コード例 #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());
        }
コード例 #3
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());
        }
コード例 #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);
        }