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; }
public async STT.Task ResetTest() { var mock = new M.Mock <IOperation>(); var option = new AO.Reset(); mock.Setup(op => op.Reset(M.It.IsAny <AO.Reset>())).Returns(A.Utility.TaskExitSuccess); Assert.Equal(ExitCode.Success, await AT.Utility.FromOk(option.Operate(mock.Object)).ConfigureAwait(false)); mock.Verify(op => op.Reset(option)); }
public async STT.Task OperateTest(uint index) { var mock = new M.Mock <IOperation>(); var maybePossibleOption = External.Parse(Configuration, $@"alias{index}"); var option = AT.Utility.FromOk(AT.Utility.FromJust(maybePossibleOption)); mock.Setup(op => op.External(M.It.IsAny <External>())) .Returns(Utility.TaskExitSuccess); Assert.Equal(ExitCode.Success, await AT.Utility.FromOk(option.Operate(mock.Object)).ConfigureAwait(false)); mock.Verify(op => op.External(option)); }