コード例 #1
0
        public async Task Execute_Success(string description, string json)
        {
            TestStore store   = new TestStore(json);
            var       command = new CheckCommand(new FileInfo("./fake_file.json"), store);

            TestConsole console = new TestConsole();
            await command.InvokeAsync(console);

            Assert.True(store.WasRead);
            Assert.Null(store.Output);
            Assert.False(store.WasWritten);
            var output = console.Out.ToString() !;

            Assert.NotEqual(0, output.Length);
            Assert.True(true, description);
        }
コード例 #2
0
        public async Task Execute_Symmetric(string?outputPath, string?password, uint?iterationCount, uint?saltSize, int length, string?alg, string?use, string?[] keyOps, string?kid, bool noKid, bool force)
        {
            TestStore store   = new TestStore();
            var       command = new NewCommand.NewSymmetricCommand.NewSymmetricCommandHandler(outputPath is null ? null : new FileInfo(outputPath), password, iterationCount, saltSize, length, alg, use, keyOps is null ? new List <string?>() : new List <string?>(keyOps), kid, noKid, force, store);

            TestConsole console = new TestConsole();
            await command.InvokeAsync(console);

            Assert.False(store.WasRead);
            if (outputPath is null)
            {
                Assert.Null(store.Output);
                Assert.False(store.WasWritten);
                var output = console.Out.ToString() !;
                Assert.NotEqual(0, output.Length);
            }
            else
            {
                Assert.NotNull(store.Output);
                Assert.True(store.WasWritten);
                var output = console.Out.ToString() !;
                Assert.Equal(0, output.Length);
            }
        }
コード例 #3
0
        public async Task Execute_X509(string certificatePassword, string?data, string inputPath, string?outputPath, string?password, uint?iterationCount, uint?saltSize)
        {
            TestStore store   = new TestStore(data, _certificateRaw);
            var       command = new ConvertCommand.ConvertX509Command.ConvertX509CommandHandler(certificatePassword, password, iterationCount, saltSize, new FileInfo(inputPath), outputPath is null ? null : new FileInfo(outputPath), true, store);

            TestConsole console = new TestConsole();
            await command.InvokeAsync(console);

            Assert.True(store.WasRead);
            if (outputPath is null)
            {
                Assert.Null(store.Output);
                Assert.False(store.WasWritten);
                var output = console.Out.ToString() !;
                Assert.NotEqual(0, output.Length);
            }
            else
            {
                Assert.NotNull(store.Output);
                Assert.True(store.WasWritten);
                var output = console.Out.ToString() !;
                Assert.Equal(0, output.Length);
            }
        }