Exemplo n.º 1
0
            public void PropagatesCorrectIdsToGetMultipleTimeEntriesInteractor()
            {
                setupTest();

                testedInteractor.Execute().Wait();

                interactorFactory.Received().GetMultipleTimeEntriesById(
                    Arg.Is <long[]>(propagatedIds => propagatedIds.SetEquals(ids, null)));
            }
        public async Task ClearsThePushNotificationsTokenStorage()
        {
            PushNotificationsTokenService.Token.Returns(new PushNotificationsToken("token"));
            pushNotificationsTokenStorage.PreviouslyRegisteredToken.Returns(new PushNotificationsToken("token"));

            await interactor.Execute();

            pushNotificationsTokenStorage.Received().Clear();
        }
Exemplo n.º 3
0
 public IObservable <TType> Execute()
 {
     return(innerInteractor.Execute()
            .Catch <TType, TException>(e =>
     {
         ((TrackableInteractor)innerInteractor).AnalyticsService.Track(e, message);
         return Observable.Throw <TType>(e);
     }));
 }
 public async void Handle(object sender, MyEventArgs e)
 {
     try
     {
         await _interactor.Execute(new XLSFileRequestDTO { FileName = "Ссылки.xlsx", ListName = "flm", ColumnsNumber = new int[] { 2, 3 }, TopRowNumber = 2 });
     }
     catch (Exception ex)
     {
         _messageServiceUI.ShowError(ex.Message);
     }
 }
Exemplo n.º 5
0
 public async void Handle(object sender, MyEventArgs e)
 {
     try
     {
         await _interactor.Execute(new FilmNameRequestDTO { FilmName = e.MyEventParameter });
     }
     catch (Exception ex)
     {
         _messageServiceUI.ShowError(ex.Message);
     }
 }
Exemplo n.º 6
0
 public async void Handle(object sender, MyEventArgs e)
 {
     try
     {
         await _interactor.Execute(new XLSFileRequestDTO { FileName      = "Solar system.xlsx", ListName = "Лист1",
                                                           ColumnsNumber = new int[] { 1, 8, 11 }, TopRowNumber = 3, TargetFolder = $@"{Directory.GetCurrentDirectory()}\PlanetImages\" });
     }
     catch (Exception ex)
     {
         var st    = new StackTrace(ex, true);
         var frame = st.GetFrame(0);
         _messageServiceUI.ShowError($"{ ex.Message}  { frame.GetMethod().ReflectedType.FullName}   { frame.GetFileLineNumber()}  {ex.ToString()}");
     }
 }
Exemplo n.º 7
0
        private async Task <bool> delete(ActionType actionType, int entriesCount, IInteractor <IObservable <Unit> > deletionInteractor)
        {
            var isDeletionConfirmed = await dialogService.ConfirmDestructiveAction(actionType, entriesCount);

            if (!isDeletionConfirmed)
            {
                return(false);
            }

            await deletionInteractor.Execute();

            syncManager.InitiatePushSync();
            analyticsService.DeleteTimeEntry.Track();

            return(true);
        }
Exemplo n.º 8
0
        private static async void BotOnMessageReceived(object sender, MessageEventArgs messageEventArgs)
        {
            IUser user = await userFactory.Create(messageEventArgs.Message.From.Id).ConfigureAwait(false);

            IInteractor interactor = await interactorFactory.Create(user, botClient).ConfigureAwait(false);

            IMessage message = messageFactory.Create(messageEventArgs);

            await interactor.Execute(message).ConfigureAwait(false);


            //var message = messageEventArgs.Message;
            //if (message?.Type == MessageType.Text) {

            //	await client.DeleteMessageAsync(message.Chat.Id, message.MessageId).ConfigureAwait(false);

            //	await client.SendTextMessageAsync(message.Chat.Id, message.Text);
            //}
        }
Exemplo n.º 9
0
        private async Task <bool> delete(ActionType actionType, int entriesCount, IInteractor <IObservable <Unit> > deletionInteractor)
        {
            var isDeletionConfirmed = await View.ConfirmDestructiveAction(actionType, entriesCount);

            if (!isDeletionConfirmed)
            {
                return(false);
            }

            await deletionInteractor.Execute();

            syncManager.InitiatePushSync();

            var deleteMode = entriesCount > 1
                ? DeleteTimeEntryOrigin.GroupedEditView
                : DeleteTimeEntryOrigin.EditView;

            analyticsService.DeleteTimeEntry.Track(deleteMode);

            return(true);
        }
        public async Task TryHandle(object msg, IMessageHandlerContext context, IInteractor svc)
        {
            try
            {
                await svc.Execute(msg);

                foreach (var e in svc.GetPublishedEvents())
                {
                    await context.Publish(e).ConfigureAwait(false);
                }
            }
            catch (DomainError ex)
            {
                Log.Error(ex.Name);
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message);
                throw;
            }
        }
Exemplo n.º 11
0
        public async Task ClearsTheDatabase()
        {
            await interactor.Execute();

            await Database.Received(1).Clear();
        }
Exemplo n.º 12
0
        public static int Main()
        {
            IInteractor interactor = CreateInteractor();

            return(interactor.Execute());
        }
 public Task <UseCaseResult> Execute(TUseCase usecase, TOutputPort outputPort, Func <TUseCase, Task <UseCaseResult> > next, CancellationToken cancellationToken)
 => _interactor.Execute(usecase, outputPort, cancellationToken);