Example #1
0
 public OperationTests()
 {
     _mockEffect = new M.Mock <IEffect>();
     _fakeApp    = new ATF.FakeFile(@"Application Name", @"Application Directory");
     _fakeConf   = new ATF.FakeTextFile(string.Empty, string.Empty, string.Empty);
     _fakeEnv    = new ATF.FakeEnvironment(_fakeApp.Mock.Object, Enumerable.Empty <string>(), _fakeConf.Mock.Object, _mockEffect.Object, @"Working Directory", string.Empty);
     _mockEnv    = _fakeEnv.Mock;
 }
Example #2
0
        public async STT.Task DisplayMessageTest(S.Exception exception, string message)
        {
            using var fakeFileDisposable = new ATF.FakeFile(string.Empty, string.Empty);
            var fakeFile = fakeFileDisposable.Mock.Object;

            using var env = new ATF.FakeEnvironment(fakeFile, Enumerable.Empty <string>(), fakeFile, new M.Mock <IEffect>().Object, string.Empty, string.Empty);
            await exception.DisplayMessage(ST.Factory.Maybe(env.Mock.Object)).ConfigureAwait(false);

            Assert.Equal(message, env.StreamError.ToString().Trim());
        }
Example #3
0
 public async STT.Task EntryTest(ExitCode expectedExitCode, string expectedOut, string expectedError, string configuration, string name, Arguments arguments)
 {
     using var fake = new ATF.FakeTextFile
                          (@"alias.conf"
                          , @"directory"
                          , configuration
                          );
     using var fakeFileDisposable = new ATF.FakeFile(name, string.Empty);
     using var environment        = new ATF.FakeEnvironment(fakeFileDisposable.Mock.Object, arguments, fake.Mock.Object, new Effect(), S.Environment.CurrentDirectory, string.Empty);
     Assert.Equal(expectedExitCode, await Program.Entry(() => environment.Mock.Object).ConfigureAwait(false));
     Assert.Equal(expectedOut, environment.StreamOut.ToString());
     Assert.Equal(expectedError, environment.StreamError.ToString());
 }