public NotesClientTest() { var auth = new Authentication(AppId, AppKey); var restClientFactory = new RestClientFactory(auth); notesClient = new NotesClient(restClientFactory); }
public async Task RequestsCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new NotesClient(connection); var filters = new NoteFilters { PageSize = 1, PageCount = 1, StartPage = 0, }; await client.GetAll(filters); Received.InOrder(async() => { await connection.GetAll <Note>( Arg.Is <Uri>(u => u.ToString() == "notes"), Arg.Is <Dictionary <string, string> >(d => d.Count == 0), Arg.Is <ApiOptions>(o => o.PageSize == 1 && o.PageCount == 1 && o.StartPage == 0) ); }); }
public MisskeyClient(Credential credential, HttpClientHandler innerHandler = null) : base(credential, new MisskeyAuthenticationHandler(innerHandler), RequestMode.Json) { BinaryParameters = new List <string> { "file" }; Aggregation = new AggregationClient(this); Ap = new ApClient(this); Admin = new AdminClient(this); App = new MisskeyAppClient(this); Auth = new AuthClient(this); Blocking = new BlockingClient(this); Charts = new ChartsClient(this); Drive = new DriveClient(this); Federation = new FederationClient(this); Following = new FollowingClient(this); Hashtags = new HashtagsClient(this); I = new IClient(this); Messaging = new MessagingClient(this); Mute = new MuteClient(this); My = new MyClient(this); Notes = new NotesClient(this); Notifications = new NotificationsClient(this); Streaming = new StreamingClient(this); Username = new UsernameClient(this); Users = new UsersClient(this); }
public void DeletesCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new NotesClient(connection); client.Delete(123); connection.Received().Delete(Arg.Is <Uri>(u => u.ToString() == "notes/123")); }
public ActionResult Edit([Bind(Include = "noteID,clientID,trajetID,note")] NotesClient notesClient) { if (ModelState.IsValid) { _serviceNotesClients.ModifierNotesClient(notesClient); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(notesClient)); }
public void PostsToTheCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new NotesClient(connection); var newNote = new NewNote("content"); client.Create(newNote); connection.Received().Post <Note>(Arg.Is <Uri>(u => u.ToString() == "notes"), Arg.Is <NewNote>(d => d.Content == "content")); }
public async Task RequestsCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new NotesClient(connection); await client.Get(123); Received.InOrder(async() => { await connection.Get <Note>(Arg.Is <Uri>(u => u.ToString() == "notes/123")); }); }
public void PutsCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new NotesClient(connection); var editNote = new NoteUpdate { Content = "content" }; client.Edit(123, editNote); connection.Received().Put <Note>(Arg.Is <Uri>(u => u.ToString() == "notes/123"), Arg.Is <NoteUpdate>(d => d.Content == "content")); }
private void SaveCommand_Execute() { try { NotesClient.EditNote(SelectedItem); Navigation.NavigateToNotesPage(); } catch (CommunicationException) { Page.ShowError("Ooops no connection to server... Try again later."); } catch (Exception ex) { Page.ShowError(ex.Message); } }
private void DeleteCommand_Execute() { try { NotesClient.DeleteNote(SelectedItem.Id); Notes.Remove(SelectedItem); SelectedItem = null; } catch (CommunicationException) { Page.ShowError("Ooops no connection to server... Try again later."); } catch (Exception ex) { Page.ShowError(ex.Message); } }
private void SaveCommand_Execute() { try { SelectedItem.CreationDate = DateTime.Now.Date; SelectedItem.Id = NotesClient.AddNote(SelectedItem); Notes.Add(SelectedItem); Navigation.NavigateToNotesPage(); } catch (CommunicationException) { Page.ShowError("Ooops no connection to server... Try again later."); } catch (Exception ex) { Page.ShowError(ex.Message); } }
public async void UpdateNotes() { try { if (_filter) { Notes = await NotesClient.GetLastNotes(StartDate, EndDate); } else { Notes = await NotesClient.GetLastNotes(20); } } catch (CommunicationException) { Page.ShowError("Ooops no connection to server... Try again later."); } catch (Exception ex) { Page.ShowError(ex.Message); } }
private void RegisterCommand_Excute() { try { if (NotesClient.Register(UserName.Trim(), Page.GetPassword.Trim(), Email.Trim())) { ResetData(); Navigation.NavigateToLoginPage(); } else { Page.ShowError("This username or email already used"); } } catch (CommunicationException) { Page.ShowError("Ooops no connection to server... Try again later."); } catch (Exception ex) { Page.ShowError(ex.Message); } }
private void LoginCommand_Excute() { try { if (!NotesClient.Login(UserName.Trim(), Page.GetPassword.Trim())) { Page.ShowError("Wrong username or password"); } else { ResetData(); Navigation.NavigateToNotesPage(); } } catch (CommunicationException) { Page.ShowError("Ooops no connection to server... Try again later."); } catch (Exception ex) { Page.ShowError(ex.Message); } }
public void Notes() { Utils.UseApiEnvironment((_, api, token) => { using (var baseClient = api.CreateClient()) { INotesClient client = new NotesClient(baseClient); Assert.IsFalse(client.GetAll(token).Result.Any()); Assert.IsNull(client.Get(token, 0).Result); client.Clear(token).Wait(); { Note node = new Note { Title = "name" }; int id = client.Create(token, node).Result.Value; Assert.AreEqual(node.Title, client.Query(token, id).Result.First().Title); node.Content = "content"; Assert.IsTrue(client.Update(token, id, node).Result.HasValue); Assert.IsTrue(client.Delete(token, id).Result.HasValue); } } }); }
public CustomNotesClient(HttpClient http) { innerClient = new NotesClient(http); base.Configurate(); }
public NotesClientTest() { this.notesClient = new NotesClient(new Authentication(AppId, AppKey)); }
public async Task EnsuresNonNullArguments() { var client = new NotesClient(Substitute.For <IApiConnection>()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create(null)); }
public void SupprimerNotesClient(NotesClient unNotesClient) { uw.NotesClientsRepository.Delete(unNotesClient); uw.Save(); }
public void ModifierNotesClient(NotesClient unNotesClient) { uw.NotesClientsRepository.Update(unNotesClient); uw.Save(); }
public void AjouterNotesClients(NotesClient unNotesClients) { uw.NotesClientsRepository.Insert(unNotesClients); uw.Save(); }
public void SetUp() { _server = new TestServer(new WebHostBuilder().UseStartup <ModNotes.Startup>()); _httpClient = _server.CreateClient(); _client = new NotesClient(_httpClient); }