public void ServiceConnectorSendMessageTest() { // arrange IServiceConnector serviceConnector = ServiceConnector.GetInstance(); serviceConnector.SetAddress("http://localhost:5000/"); serviceConnector.TrySetUsername("testUser", out var testUser); // act var result = serviceConnector.SendMessage(_adminUserId, "Hallo test"); // assert Assert.IsNotNull(result); }
public void ServiceConnectorGetMessagesTest() { // arrange IServiceConnector serviceConnector = ServiceConnector.GetInstance(); serviceConnector.SetAddress("http://localhost:5000/"); serviceConnector.TrySetUsername("testUser", out var testUser); // act var result = serviceConnector.GetMessages(_adminUserId); // assert Assert.IsNotNull(result); Assert.IsTrue(result.Any()); Assert.AreEqual("Hallo ich bin der Admin Benutzer", result.First().Text); }
public void ServiceConnectorSetUserAndGetAllUsersTest() { // arrange IServiceConnector serviceConnector = ServiceConnector.GetInstance(); serviceConnector.SetAddress("http://localhost:5000/"); serviceConnector.TrySetUsername("testUser", out var testUser); // act var result = serviceConnector.GetAllUsers(); // assert Assert.IsNotNull(result); // only admin, well it show only other not self user Assert.AreEqual(1, result.Length); }
public void ServiceConnectorTrySetUsernameTest() { // arrange IServiceConnector serviceConnector = ServiceConnector.GetInstance(); serviceConnector.SetAddress("http://localhost:5000/"); const string username = "******"; // act var success = serviceConnector.TrySetUsername(username, out var result); // assert Assert.IsTrue(success); Assert.IsNotNull(result); Assert.AreEqual(username, result.Username); Assert.AreNotEqual(0, result.ID); }
public void ServiceConnectorSendMessageAndGetMessageTest() { // arrange IServiceConnector serviceConnector = ServiceConnector.GetInstance(); serviceConnector.SetAddress("http://localhost:5000/"); serviceConnector.TrySetUsername("testUser", out _); // act serviceConnector.SendMessage(_adminUserId, "Hallo test"); var result = serviceConnector.GetMessages(_adminUserId); // assert Assert.IsNotNull(result); Assert.IsTrue(result.Any()); Assert.AreEqual("Hallo test", result.Last().Text); }