Пример #1
0
        public async void handlerShouldExecuteCorrectly()
        {
            var mailClient = new Mock <IMailClient>();

            mailClient.Setup(obj => obj.Send(It.IsAny <NoteUpdatedMail>())).Verifiable();

            var handler = new SendNoteUpdatedMail(mailClient.Object);

            var noteEvent = new NoteUpdated(1, "mytitle", "mydescription");

            await handler.Handle(noteEvent, new CancellationToken());

            mailClient.Verify();
        }
Пример #2
0
        async private void TextChanged(object sender, TextChangedEventArgs e)
        {
            var note = BindingContext as Notes;

            if (note.Id == 0)
            {
                await _connection.InsertAsync(note);

                NoteAdded?.Invoke(this, note);
            }
            else
            {
                await _connection.UpdateAsync(note);

                NoteUpdated?.Invoke(this, note);
            }
        }