Ejemplo n.º 1
0
        /// <inheritdoc />
        protected override async Task <Result <Unit, IError> > Run(
            IStateMonad stateMonad,
            CancellationToken cancellationToken)
        {
            await Task.CompletedTask;

            var r = await stateMonad.CloseNuixConnectionAsync(this, cancellationToken);

            return(r.MapError(x => x.WithLocation(this)));
        }
Ejemplo n.º 2
0
        public async Task CloseNuixConnectionAsync_WhenNoConnectionExists_DoesNothing()
        {
            var fakeExternalProcess = new ExternalProcessMock(
                1,
                ConnectionTestsHelper.GetCreateCaseAction()
                );

            IStateMonad state = ConnectionTestsHelper.GetStateMonad(
                fakeExternalProcess,
                TestLoggerFactory.Create()
                );

            var ct = new CancellationToken();

            var actual = await state.CloseNuixConnectionAsync(null, ct);

            Assert.True(actual.IsSuccess);
            Assert.Equal(Unit.Default, actual);
        }