public void CanGetSessionsList() { using (var undoContext = UndoContext.Current) { undoContext.Start(); RemoteAppManagementClient client = GetRemoteAppManagementClient(); CollectionSessionListResult sessionsResponse = client.Collections.ListSessions("testd112"); RemoteAppSession session = null; Assert.NotNull(sessionsResponse); Assert.NotNull(sessionsResponse.Sessions); Assert.True(sessionsResponse.StatusCode == HttpStatusCode.OK); Assert.Empty(sessionsResponse.Sessions); // verify the serialization of the response with one item sessionsResponse = client.Collections.ListSessions("simple"); Assert.NotNull(sessionsResponse); Assert.NotNull(sessionsResponse.Sessions); Assert.True(sessionsResponse.StatusCode == HttpStatusCode.OK); Assert.NotEmpty(sessionsResponse.Sessions); Assert.True(sessionsResponse.Sessions.Count == 1, "There must be only 1 session here."); session = sessionsResponse.Sessions[0]; // these data are validated from the recorded json file Assert.NotNull(session); Assert.True(session.State == SessionState.Connected); } }
public void CanSendMessageToASessionInACollection() { using (var undoContext = UndoContext.Current) { undoContext.Start(); RemoteAppManagementClient client = GetRemoteAppManagementClient(); SessionSendMessageCommandParameter parameter = new SessionSendMessageCommandParameter { UserUpn = "*****@*****.**", Message = "Hello there!" }; // testing the web fault OperationResultWithTrackingId response = null; response = client.Collections.SendMessageToSession("simple", parameter); Assert.NotNull(response); Assert.NotNull(response.TrackingId); Assert.Equal(HttpStatusCode.Accepted, response.StatusCode); AssertLongrunningOperation(client, RemoteAppOperationStatus.Success, response.TrackingId); CollectionSessionListResult sessionList = client.Collections.ListSessions("simple"); Assert.NotNull(sessionList); Assert.NotNull(sessionList.Sessions); Assert.True(sessionList.StatusCode == HttpStatusCode.OK); Assert.NotEmpty(sessionList.Sessions); RemoteAppSession session = null; foreach (var s in sessionList.Sessions) { if (s.UserUpn == parameter.UserUpn) { session = s; break; } } Assert.NotNull(session); Assert.True(session.State == SessionState.Connected); } }
public void CanLogOffASessionFromACollection() { using (var undoContext = UndoContext.Current) { undoContext.Start(); RemoteAppManagementClient client = GetRemoteAppManagementClient(); SessionCommandParameter parameter = new SessionCommandParameter { UserUpn = "*****@*****.**" }; // testing the web fault OperationResultWithTrackingId response = null; response = client.Collections.LogoffSession("simple", parameter); Assert.NotNull(response); Assert.NotNull(response.TrackingId); Assert.Equal(HttpStatusCode.Accepted, response.StatusCode); AssertLongrunningOperation(client, RemoteAppOperationStatus.Success, response.TrackingId); TestUtilities.Wait(20000); //wait a little bit CollectionSessionListResult sessionList = client.Collections.ListSessions("simple"); Assert.NotNull(sessionList); Assert.NotNull(sessionList.Sessions); Assert.True(sessionList.StatusCode == HttpStatusCode.OK); RemoteAppSession session = null; foreach (var s in sessionList.Sessions) { if (s.UserUpn == parameter.UserUpn) { session = s; break; } } Assert.Null(session); } }