public async Task GetHealthStatusTest() { GotifySharp gotifySharp = new GotifySharp(Settings.Config); var res = await gotifySharp.GetHealthStatusAsync(); res.Health.health.Should().Be("green"); }
public async Task GetAllMessagesTestAsync() { GotifySharp gotifySharp = new GotifySharp(Settings.Config); var res = await gotifySharp.GetVersionInfo(); res.Version.commit.Should().Be("7cf5c555f5b55e5080cb1f0d06aecd72809bebe8"); }
public async Task GetApplicationsTestAsync() { GotifySharp gotifySharp = new GotifySharp(Settings.Config); var res = await gotifySharp.GetApplications(); res.Success.Should().BeTrue(); }
public async Task CreateClientTestAsync() { GotifySharp gotifySharp = new GotifySharp(Settings.Config); var res = await gotifySharp.CreateClientAsync("Test"); res.Success.Should().BeTrue(); }
public void Configure(string Url, int port, string Username, string Password, string Path, String Protocol) { IConfig config = new AppConfig(Username, Password, Url, port, Protocol, Path); gotifySharp = new GotifySharp(config); gotifySharp.OnMessage += GotifySharp_OnMessage; gotifySharp.OnDisconnect += GotifySharp_OnDisconnect; gotifySharp.OnReconnect += GotifySharp_OnReconnect; }
public async Task GetMessagesForAppTestAsync() { GotifySharp gotifySharp = new GotifySharp(Settings.Config); var app = await gotifySharp.CreateApplicationAsync("Name", "Description"); var res = await gotifySharp.GetMessageForApplicationAsync(app.Response.id); res.Success.Should().BeTrue(); }
public async Task SendMessageTestAsync() { GotifySharp gotifySharp = new GotifySharp(Settings.Config); var app = await gotifySharp.CreateApplicationAsync("Name", "Description"); var res = await gotifySharp.SendMessage("Message", "Test", app.Response.token, 2); res.Success.Should().BeTrue(); }
public GotifyService(ServerInfo serverInfo) { _serverInfo = serverInfo; IConfig config = new AppConfig(serverInfo.Username, serverInfo.Password, serverInfo.Url, serverInfo.Port, serverInfo.Protocol, serverInfo.Path); gotifySharp = new GotifySharp(config); gotifySharp.OnMessage += GotifySharp_OnMessage; gotifySharp.OnDisconnect += GotifySharp_OnDisconnect; gotifySharp.OnReconnect += GotifySharp_OnReconnect; }
public async Task DeleteClientTestAsync() { GotifySharp gotifySharp = new GotifySharp(Settings.Config); var createResponse = await gotifySharp.CreateClientAsync("Test"); var results = await gotifySharp.DeleteClientAsync(createResponse.ClientModel.Id.ToString()); results.Should().BeTrue(); }
public static async Task <bool> TestConnectionAsync(string Url, int port, string Username, string Password, string Path, string Protocol) { IConfig config = new AppConfig(Username, Password, Url, port, Protocol, Path); GotifySharp gotifySharp = new GotifySharp(config); try { var res = await gotifySharp.GetApplications(); if (res.Success) { return(true); } else { return(false); } } catch (HttpRequestException HttpExcep) { throw HttpExcep; } }