コード例 #1
0
        public async Task ConfigureCommand_ExecuteAsync_System_InvokesConfigurationServiceConfigureSystem()
        {
            var configService = new Mock <IConfigurationService>();

            configService.Setup(x => x.ConfigureAsync(It.IsAny <ConfigurationTarget>()))
            .Returns(Task.CompletedTask)
            .Verifiable();

            var context = new TestCommandContext();
            var command = new ConfigureCommand(context, configService.Object);

            await command.ExecuteAsync(true);

            configService.Verify(x => x.ConfigureAsync(ConfigurationTarget.System), Times.Once);
        }
コード例 #2
0
        public async Task ConfigureCommand_ExecuteAsync_User_InvokesConfigurationServiceConfigureUser()
        {
            var configService = new Mock <IConfigurationService>();

            configService.Setup(x => x.ConfigureAsync(It.IsAny <ConfigurationTarget>()))
            .Returns(Task.CompletedTask)
            .Verifiable();

            var context = new TestCommandContext();

            string[] cmdArgs = { "configure" };
            var      command = new ConfigureCommand(configService.Object);

            await command.ExecuteAsync(context, cmdArgs);

            configService.Verify(x => x.ConfigureAsync(ConfigurationTarget.User), Times.Once);
        }