Resolved dependencies from communication API on UI.
This commit is contained in:
parent
affd5de6a7
commit
487e89693a
18 changed files with 130 additions and 146 deletions
|
@ -113,9 +113,8 @@ namespace SafeExamBrowser.Client.UnitTests
|
|||
{
|
||||
var args = new MessageBoxRequestEventArgs
|
||||
{
|
||||
// TODO
|
||||
//Action = MessageBoxAction.YesNo,
|
||||
//Icon = MessageBoxIcon.Question,
|
||||
Action = (int) MessageBoxAction.YesNo,
|
||||
Icon = (int) MessageBoxIcon.Question,
|
||||
Message = "Some question to be answered",
|
||||
RequestId = Guid.NewGuid(),
|
||||
Title = "A Title"
|
||||
|
@ -123,18 +122,17 @@ namespace SafeExamBrowser.Client.UnitTests
|
|||
|
||||
messageBox.Setup(m => m.Show(
|
||||
It.Is<string>(s => s == args.Message),
|
||||
It.Is<string>(s => s == args.Title), default(MessageBoxAction), default(MessageBoxIcon), null
|
||||
// TODO
|
||||
//It.Is<MessageBoxAction>(a => a == args.Action),
|
||||
//It.Is<MessageBoxIcon>(i => i == args.Icon),
|
||||
/*It.IsAny<IWindow>()*/)).Returns(MessageBoxResult.No);
|
||||
It.Is<string>(s => s == args.Title),
|
||||
It.Is<MessageBoxAction>(a => a == (MessageBoxAction) args.Action),
|
||||
It.Is<MessageBoxIcon>(i => i == (MessageBoxIcon) args.Icon),
|
||||
It.IsAny<IWindow>())).Returns(MessageBoxResult.No);
|
||||
|
||||
sut.TryStart();
|
||||
clientHost.Raise(c => c.MessageBoxRequested += null, args);
|
||||
|
||||
runtimeProxy.Verify(p => p.SubmitMessageBoxResult(
|
||||
It.Is<Guid>(g => g == args.RequestId)// TODO ,
|
||||
/*It.Is<MessageBoxResult>(r => r == MessageBoxResult.No)*/), Times.Once);
|
||||
It.Is<Guid>(g => g == args.RequestId),
|
||||
It.Is<int>(r => r == (int) MessageBoxResult.No)), Times.Once);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
|
|
@ -154,8 +154,8 @@ namespace SafeExamBrowser.Client.UnitTests.Communication
|
|||
[TestMethod]
|
||||
public void MustHandleMessageBoxRequestCorrectly()
|
||||
{
|
||||
var action = MessageBoxAction.YesNo;
|
||||
var icon = MessageBoxIcon.Question;
|
||||
var action = (int) MessageBoxAction.YesNo;
|
||||
var icon = (int) MessageBoxIcon.Question;
|
||||
var message = "Qwert kndorz safie abcd?";
|
||||
var messageBoxRequested = false;
|
||||
var requestId = Guid.NewGuid();
|
||||
|
@ -164,15 +164,13 @@ namespace SafeExamBrowser.Client.UnitTests.Communication
|
|||
|
||||
sut.MessageBoxRequested += (args) =>
|
||||
{
|
||||
// TODO
|
||||
messageBoxRequested = /*args.Action == action && args.Icon == icon &&*/ args.Message == message && args.RequestId == requestId && args.Title == title;
|
||||
messageBoxRequested = args.Action == action && args.Icon == icon && args.Message == message && args.RequestId == requestId && args.Title == title;
|
||||
resetEvent.Set();
|
||||
};
|
||||
sut.AuthenticationToken = Guid.Empty;
|
||||
|
||||
var token = sut.Connect(Guid.Empty).CommunicationToken.Value;
|
||||
// TODO
|
||||
var request = new MessageBoxRequestMessage(/*action, icon, */message, requestId, title) { CommunicationToken = token };
|
||||
var request = new MessageBoxRequestMessage(action, icon, message, requestId, title) { CommunicationToken = token };
|
||||
var response = sut.Send(request);
|
||||
|
||||
resetEvent.WaitOne();
|
||||
|
@ -282,8 +280,7 @@ namespace SafeExamBrowser.Client.UnitTests.Communication
|
|||
|
||||
var token = sut.Connect(Guid.Empty).CommunicationToken.Value;
|
||||
|
||||
// TODO
|
||||
sut.Send(new MessageBoxRequestMessage(/*default(MessageBoxAction), default(MessageBoxIcon), */"", Guid.Empty, "") { CommunicationToken = token });
|
||||
sut.Send(new MessageBoxRequestMessage(default(int), default(int), "", Guid.Empty, "") { CommunicationToken = token });
|
||||
sut.Send(new PasswordRequestMessage(default(PasswordRequestPurpose), Guid.Empty) { CommunicationToken = token });
|
||||
sut.Send(new ReconfigurationDeniedMessage("") { CommunicationToken = token });
|
||||
sut.Send(new SimpleMessage(SimpleMessagePurport.Shutdown) { CommunicationToken = token });
|
||||
|
|
|
@ -282,9 +282,11 @@ namespace SafeExamBrowser.Client
|
|||
{
|
||||
logger.Info($"Received message box request with id '{args.RequestId}'.");
|
||||
|
||||
var result = messageBox.Show(args.Message, args.Title/*,// TODO args.Action, args.Icon*/, parent: splashScreen);
|
||||
var action = (MessageBoxAction) args.Action;
|
||||
var icon = (MessageBoxIcon) args.Icon;
|
||||
var result = messageBox.Show(args.Message, args.Title, action, icon, parent: splashScreen);
|
||||
|
||||
runtime.SubmitMessageBoxResult(args.RequestId/*// TODO , result*/);
|
||||
runtime.SubmitMessageBoxResult(args.RequestId, (int) result);
|
||||
logger.Info($"Message box request with id '{args.RequestId}' yielded result '{result}'.");
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace SafeExamBrowser.Client.Communication
|
|||
switch (message)
|
||||
{
|
||||
case MessageBoxRequestMessage m:
|
||||
MessageBoxRequested?.InvokeAsync(new MessageBoxRequestEventArgs { /*// TODO Action = m.Action, Icon = m.Icon,*/ Message = m.Message, RequestId = m.RequestId, Title = m.Title });
|
||||
MessageBoxRequested?.InvokeAsync(new MessageBoxRequestEventArgs { Action = m.Action, Icon = m.Icon, Message = m.Message, RequestId = m.RequestId, Title = m.Title });
|
||||
return new SimpleResponse(SimpleResponsePurport.Acknowledged);
|
||||
case PasswordRequestMessage m:
|
||||
PasswordRequested?.InvokeAsync(new PasswordRequestEventArgs { Purpose = m.Purpose, RequestId = m.RequestId });
|
||||
|
|
|
@ -21,16 +21,15 @@ namespace SafeExamBrowser.Communication.Contracts.Data
|
|||
/// </summary>
|
||||
public Guid RequestId { get; private set; }
|
||||
|
||||
// TODO
|
||||
///// <summary>
|
||||
///// The result of the interaction.
|
||||
///// </summary>
|
||||
//public MessageBoxResult Result { get; private set; }
|
||||
/// <summary>
|
||||
/// The result of the interaction.
|
||||
/// </summary>
|
||||
public int Result { get; private set; }
|
||||
|
||||
public MessageBoxReplyMessage(Guid requestId)// TODO, MessageBoxResult result)
|
||||
public MessageBoxReplyMessage(Guid requestId, int result)
|
||||
{
|
||||
RequestId = requestId;
|
||||
// TODOResult = result;
|
||||
Result = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,16 +16,15 @@ namespace SafeExamBrowser.Communication.Contracts.Data
|
|||
[Serializable]
|
||||
public class MessageBoxRequestMessage : Message
|
||||
{
|
||||
// TODO
|
||||
///// <summary>
|
||||
///// The action to be displayed.
|
||||
///// </summary>
|
||||
//public MessageBoxAction Action { get; private set; }
|
||||
/// <summary>
|
||||
/// The action to be displayed.
|
||||
/// </summary>
|
||||
public int Action { get; private set; }
|
||||
|
||||
///// <summary>
|
||||
///// The icon to be displayed.
|
||||
///// </summary>
|
||||
//public MessageBoxIcon Icon { get; private set; }
|
||||
/// <summary>
|
||||
/// The icon to be displayed.
|
||||
/// </summary>
|
||||
public int Icon { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The message to be displayed.
|
||||
|
@ -42,11 +41,10 @@ namespace SafeExamBrowser.Communication.Contracts.Data
|
|||
/// </summary>
|
||||
public string Title { get; private set; }
|
||||
|
||||
public MessageBoxRequestMessage(/*MessageBoxAction action, MessageBoxIcon icon, */string message, Guid requestId, string title)
|
||||
public MessageBoxRequestMessage(int action, int icon, string message, Guid requestId, string title)
|
||||
{
|
||||
// TODO
|
||||
//Action = action;
|
||||
//Icon = icon;
|
||||
Action = action;
|
||||
Icon = icon;
|
||||
Message = message;
|
||||
RequestId = requestId;
|
||||
Title = title;
|
||||
|
|
|
@ -20,10 +20,9 @@ namespace SafeExamBrowser.Communication.Contracts.Events
|
|||
/// </summary>
|
||||
public Guid RequestId { get; set; }
|
||||
|
||||
// TODO
|
||||
///// <summary>
|
||||
///// The result of the interaction.
|
||||
///// </summary>
|
||||
//public MessageBoxResult Result { get; set; }
|
||||
/// <summary>
|
||||
/// The result of the interaction.
|
||||
/// </summary>
|
||||
public int Result { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,16 +15,15 @@ namespace SafeExamBrowser.Communication.Contracts.Events
|
|||
/// </summary>
|
||||
public class MessageBoxRequestEventArgs : CommunicationEventArgs
|
||||
{
|
||||
// TODO
|
||||
///// <summary>
|
||||
///// The action to be displayed.
|
||||
///// </summary>
|
||||
//public MessageBoxAction Action { get; set; }
|
||||
/// <summary>
|
||||
/// The action to be displayed.
|
||||
/// </summary>
|
||||
public int Action { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// The icon to be displayed.
|
||||
///// </summary>
|
||||
//public MessageBoxIcon Icon { get; set; }
|
||||
/// <summary>
|
||||
/// The icon to be displayed.
|
||||
/// </summary>
|
||||
public int Icon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The message to be displayed.
|
||||
|
|
|
@ -36,10 +36,9 @@ namespace SafeExamBrowser.Communication.Contracts.Proxies
|
|||
/// </summary>
|
||||
CommunicationResult RequestPassword(PasswordRequestPurpose purpose, Guid requestId);
|
||||
|
||||
// TODO
|
||||
/// <summary>
|
||||
/// Requests the client to render a message box and subsequently return the interaction result as separate message.
|
||||
/// </summary>
|
||||
CommunicationResult ShowMessage(string message, string title, /*MessageBoxAction action, MessageBoxIcon icon, */Guid requestId);
|
||||
CommunicationResult ShowMessage(string message, string title, int action, int icon, Guid requestId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,11 +36,10 @@ namespace SafeExamBrowser.Communication.Contracts.Proxies
|
|||
/// </summary>
|
||||
CommunicationResult RequestReconfiguration(string filePath);
|
||||
|
||||
// TODO
|
||||
/// <summary>
|
||||
/// Submits the result of a message box input previously requested by the runtime.
|
||||
/// </summary>
|
||||
CommunicationResult SubmitMessageBoxResult(Guid requestId/*, MessageBoxResult result*/);
|
||||
CommunicationResult SubmitMessageBoxResult(Guid requestId, int result);
|
||||
|
||||
/// <summary>
|
||||
/// Submits the result of a password input previously requested by the runtime. If the procedure was aborted by the user,
|
||||
|
|
|
@ -135,44 +135,43 @@ namespace SafeExamBrowser.Communication.UnitTests.Proxies
|
|||
Assert.IsFalse(communication.Success);
|
||||
}
|
||||
|
||||
// TODO
|
||||
//[TestMethod]
|
||||
//public void MustCorrectlyShowMessage()
|
||||
//{
|
||||
// proxy.Setup(p => p.Send(It.IsAny<MessageBoxRequestMessage>())).Returns(new SimpleResponse(SimpleResponsePurport.Acknowledged));
|
||||
[TestMethod]
|
||||
public void MustCorrectlyShowMessage()
|
||||
{
|
||||
proxy.Setup(p => p.Send(It.IsAny<MessageBoxRequestMessage>())).Returns(new SimpleResponse(SimpleResponsePurport.Acknowledged));
|
||||
|
||||
// var communication = sut.ShowMessage(default(string), default(string), default(MessageBoxAction), default(MessageBoxIcon), default(Guid));
|
||||
var communication = sut.ShowMessage(default(string), default(string), default(int), default(int), default(Guid));
|
||||
|
||||
// proxy.Verify(p => p.Send(It.IsAny<MessageBoxRequestMessage>()), Times.Once);
|
||||
// Assert.IsTrue(communication.Success);
|
||||
//}
|
||||
proxy.Verify(p => p.Send(It.IsAny<MessageBoxRequestMessage>()), Times.Once);
|
||||
Assert.IsTrue(communication.Success);
|
||||
}
|
||||
|
||||
//[TestMethod]
|
||||
//public void MustFailIfMessageBoxRequestNotAchnowledged()
|
||||
//{
|
||||
// proxy.Setup(p => p.Send(It.IsAny<MessageBoxRequestMessage>())).Returns<Response>(null);
|
||||
[TestMethod]
|
||||
public void MustFailIfMessageBoxRequestNotAchnowledged()
|
||||
{
|
||||
proxy.Setup(p => p.Send(It.IsAny<MessageBoxRequestMessage>())).Returns<Response>(null);
|
||||
|
||||
// var communication = sut.ShowMessage(default(string), default(string), default(MessageBoxAction), default(MessageBoxIcon), default(Guid));
|
||||
var communication = sut.ShowMessage(default(string), default(string), default(int), default(int), default(Guid));
|
||||
|
||||
// Assert.IsFalse(communication.Success);
|
||||
//}
|
||||
Assert.IsFalse(communication.Success);
|
||||
}
|
||||
|
||||
//[TestMethod]
|
||||
//public void MustExecuteAllOperationsFailsafe()
|
||||
//{
|
||||
// proxy.Setup(p => p.Send(It.IsAny<Message>())).Throws<Exception>();
|
||||
[TestMethod]
|
||||
public void MustExecuteAllOperationsFailsafe()
|
||||
{
|
||||
proxy.Setup(p => p.Send(It.IsAny<Message>())).Throws<Exception>();
|
||||
|
||||
// var authenticate = sut.RequestAuthentication();
|
||||
// var message = sut.ShowMessage(default(string), default(string), default(MessageBoxAction), default(MessageBoxIcon), default(Guid));
|
||||
// var password = sut.RequestPassword(default(PasswordRequestPurpose), default(Guid));
|
||||
// var reconfiguration = sut.InformReconfigurationDenied(null);
|
||||
// var shutdown = sut.InitiateShutdown();
|
||||
var authenticate = sut.RequestAuthentication();
|
||||
var message = sut.ShowMessage(default(string), default(string), default(int), default(int), default(Guid));
|
||||
var password = sut.RequestPassword(default(PasswordRequestPurpose), default(Guid));
|
||||
var reconfiguration = sut.InformReconfigurationDenied(null);
|
||||
var shutdown = sut.InitiateShutdown();
|
||||
|
||||
// Assert.IsFalse(authenticate.Success);
|
||||
// Assert.IsFalse(message.Success);
|
||||
// Assert.IsFalse(password.Success);
|
||||
// Assert.IsFalse(reconfiguration.Success);
|
||||
// Assert.IsFalse(shutdown.Success);
|
||||
//}
|
||||
Assert.IsFalse(authenticate.Success);
|
||||
Assert.IsFalse(message.Success);
|
||||
Assert.IsFalse(password.Success);
|
||||
Assert.IsFalse(reconfiguration.Success);
|
||||
Assert.IsFalse(shutdown.Success);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,49 +168,48 @@ namespace SafeExamBrowser.Communication.UnitTests.Proxies
|
|||
Assert.IsFalse(communication.Success);
|
||||
}
|
||||
|
||||
// TODO
|
||||
//[TestMethod]
|
||||
//public void MustCorrectlySubmitMessageBoxResult()
|
||||
//{
|
||||
// var result = MessageBoxResult.Ok;
|
||||
// var requestId = Guid.NewGuid();
|
||||
[TestMethod]
|
||||
public void MustCorrectlySubmitMessageBoxResult()
|
||||
{
|
||||
var result = 1234;
|
||||
var requestId = Guid.NewGuid();
|
||||
|
||||
// proxy.Setup(p => p.Send(It.IsAny<MessageBoxReplyMessage>())).Returns(new SimpleResponse(SimpleResponsePurport.Acknowledged));
|
||||
proxy.Setup(p => p.Send(It.IsAny<MessageBoxReplyMessage>())).Returns(new SimpleResponse(SimpleResponsePurport.Acknowledged));
|
||||
|
||||
// var communication = sut.SubmitMessageBoxResult(requestId, result);
|
||||
var communication = sut.SubmitMessageBoxResult(requestId, result);
|
||||
|
||||
// Assert.IsTrue(communication.Success);
|
||||
// proxy.Verify(p => p.Send(It.Is<MessageBoxReplyMessage>(m => m.Result == result && m.RequestId == requestId)), Times.Once);
|
||||
//}
|
||||
Assert.IsTrue(communication.Success);
|
||||
proxy.Verify(p => p.Send(It.Is<MessageBoxReplyMessage>(m => m.Result == result && m.RequestId == requestId)), Times.Once);
|
||||
}
|
||||
|
||||
//[TestMethod]
|
||||
//public void MustFailIfMessageBoxResultTransmissionNotAcknowledged()
|
||||
//{
|
||||
// proxy.Setup(p => p.Send(It.IsAny<MessageBoxReplyMessage>())).Returns<Response>(null);
|
||||
[TestMethod]
|
||||
public void MustFailIfMessageBoxResultTransmissionNotAcknowledged()
|
||||
{
|
||||
proxy.Setup(p => p.Send(It.IsAny<MessageBoxReplyMessage>())).Returns<Response>(null);
|
||||
|
||||
// var communication = sut.SubmitMessageBoxResult(default(Guid), default(MessageBoxResult));
|
||||
var communication = sut.SubmitMessageBoxResult(default(Guid), default(int));
|
||||
|
||||
// Assert.IsFalse(communication.Success);
|
||||
//}
|
||||
Assert.IsFalse(communication.Success);
|
||||
}
|
||||
|
||||
//[TestMethod]
|
||||
//public void MustExecuteOperationsFailsafe()
|
||||
//{
|
||||
// proxy.Setup(p => p.Send(It.IsAny<Message>())).Throws<Exception>();
|
||||
[TestMethod]
|
||||
public void MustExecuteOperationsFailsafe()
|
||||
{
|
||||
proxy.Setup(p => p.Send(It.IsAny<Message>())).Throws<Exception>();
|
||||
|
||||
// var client = sut.InformClientReady();
|
||||
// var configuration = sut.GetConfiguration();
|
||||
// var message = sut.SubmitMessageBoxResult(default(Guid), default(MessageBoxResult));
|
||||
// var password = sut.SubmitPassword(default(Guid), false);
|
||||
// var reconfiguration = sut.RequestReconfiguration(null);
|
||||
// var shutdown = sut.RequestShutdown();
|
||||
var client = sut.InformClientReady();
|
||||
var configuration = sut.GetConfiguration();
|
||||
var message = sut.SubmitMessageBoxResult(default(Guid), default(int));
|
||||
var password = sut.SubmitPassword(default(Guid), false);
|
||||
var reconfiguration = sut.RequestReconfiguration(null);
|
||||
var shutdown = sut.RequestShutdown();
|
||||
|
||||
// Assert.IsFalse(client.Success);
|
||||
// Assert.IsFalse(configuration.Success);
|
||||
// Assert.IsFalse(message.Success);
|
||||
// Assert.IsFalse(password.Success);
|
||||
// Assert.IsFalse(reconfiguration.Success);
|
||||
// Assert.IsFalse(shutdown.Success);
|
||||
//}
|
||||
Assert.IsFalse(client.Success);
|
||||
Assert.IsFalse(configuration.Success);
|
||||
Assert.IsFalse(message.Success);
|
||||
Assert.IsFalse(password.Success);
|
||||
Assert.IsFalse(reconfiguration.Success);
|
||||
Assert.IsFalse(shutdown.Success);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,12 +127,11 @@ namespace SafeExamBrowser.Communication.Proxies
|
|||
}
|
||||
}
|
||||
|
||||
// TODO
|
||||
public CommunicationResult ShowMessage(string message, string title, /*MessageBoxAction action, MessageBoxIcon icon, */Guid requestId)
|
||||
public CommunicationResult ShowMessage(string message, string title, int action, int icon, Guid requestId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(new MessageBoxRequestMessage(/*action, icon, */message, requestId, title));
|
||||
var response = Send(new MessageBoxRequestMessage(action, icon, message, requestId, title));
|
||||
var success = IsAcknowledged(response);
|
||||
|
||||
if (success)
|
||||
|
|
|
@ -127,12 +127,11 @@ namespace SafeExamBrowser.Communication.Proxies
|
|||
}
|
||||
}
|
||||
|
||||
// TODO
|
||||
public CommunicationResult SubmitMessageBoxResult(Guid requestId/*, MessageBoxResult result*/)
|
||||
public CommunicationResult SubmitMessageBoxResult(Guid requestId, int result)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(new MessageBoxReplyMessage(requestId/*, result*/));
|
||||
var response = Send(new MessageBoxReplyMessage(requestId, result));
|
||||
var acknowledged = IsAcknowledged(response);
|
||||
|
||||
if (acknowledged)
|
||||
|
|
|
@ -211,7 +211,7 @@ namespace SafeExamBrowser.Runtime.UnitTests.Communication
|
|||
{
|
||||
var args = default(MessageBoxReplyEventArgs);
|
||||
var requestId = Guid.NewGuid();
|
||||
var result = MessageBoxResult.Ok;
|
||||
var result = (int) MessageBoxResult.Ok;
|
||||
var sync = new AutoResetEvent(false);
|
||||
|
||||
sut.AllowConnection = true;
|
||||
|
@ -219,7 +219,7 @@ namespace SafeExamBrowser.Runtime.UnitTests.Communication
|
|||
sut.AuthenticationToken = Guid.Empty;
|
||||
|
||||
var token = sut.Connect(Guid.Empty).CommunicationToken.Value;
|
||||
var message = new MessageBoxReplyMessage(requestId/*// TODO , result*/) { CommunicationToken = token };
|
||||
var message = new MessageBoxReplyMessage(requestId, result) { CommunicationToken = token };
|
||||
var response = sut.Send(message);
|
||||
|
||||
sync.WaitOne();
|
||||
|
@ -229,7 +229,7 @@ namespace SafeExamBrowser.Runtime.UnitTests.Communication
|
|||
Assert.IsInstanceOfType(response, typeof(SimpleResponse));
|
||||
Assert.AreEqual(SimpleResponsePurport.Acknowledged, (response as SimpleResponse)?.Purport);
|
||||
Assert.AreEqual(requestId, args.RequestId);
|
||||
// TODO Assert.AreEqual(result, args.Result);
|
||||
Assert.AreEqual(result, args.Result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -317,7 +317,7 @@ namespace SafeExamBrowser.Runtime.UnitTests.Communication
|
|||
sut.Send(new SimpleMessage(SimpleMessagePurport.ClientIsReady) { CommunicationToken = token });
|
||||
sut.Send(new SimpleMessage(SimpleMessagePurport.ConfigurationNeeded) { CommunicationToken = token });
|
||||
sut.Send(new SimpleMessage(SimpleMessagePurport.RequestShutdown) { CommunicationToken = token });
|
||||
sut.Send(new MessageBoxReplyMessage(Guid.Empty/*// TODO , MessageBoxResult.Cancel*/) { CommunicationToken = token });
|
||||
sut.Send(new MessageBoxReplyMessage(Guid.Empty, (int) MessageBoxResult.Cancel) { CommunicationToken = token });
|
||||
sut.Send(new PasswordReplyMessage(Guid.Empty, false, "") { CommunicationToken = token });
|
||||
sut.Send(new ReconfigurationMessage("") { CommunicationToken = token });
|
||||
sut.Disconnect(new DisconnectionMessage { CommunicationToken = token });
|
||||
|
|
|
@ -330,11 +330,10 @@ namespace SafeExamBrowser.Runtime.UnitTests
|
|||
clientProxy.Setup(c => c.ShowMessage(
|
||||
It.IsAny<string>(),
|
||||
It.IsAny<string>(),
|
||||
// TODO
|
||||
//It.Is<MessageBoxAction>(a => a == MessageBoxAction.Confirm),
|
||||
//It.IsAny<MessageBoxIcon>(),
|
||||
It.Is<int>(a => a == (int) MessageBoxAction.Confirm),
|
||||
It.IsAny<int>(),
|
||||
It.IsAny<Guid>()))
|
||||
.Callback<string, string, MessageBoxAction, MessageBoxIcon, Guid>((m, t, a, i, id) =>
|
||||
.Callback<string, string, int, int, Guid>((m, t, a, i, id) =>
|
||||
{
|
||||
runtimeHost.Raise(r => r.MessageBoxReplyReceived += null, new MessageBoxReplyEventArgs { RequestId = id });
|
||||
})
|
||||
|
@ -346,9 +345,8 @@ namespace SafeExamBrowser.Runtime.UnitTests
|
|||
clientProxy.Verify(c => c.ShowMessage(
|
||||
It.IsAny<string>(),
|
||||
It.IsAny<string>(),
|
||||
// TODO
|
||||
//It.Is<MessageBoxAction>(a => a == MessageBoxAction.Confirm),
|
||||
//It.Is<MessageBoxIcon>(i => i == args.Icon),
|
||||
It.Is<int>(a => a == (int) MessageBoxAction.Confirm),
|
||||
It.Is<int>(i => i == (int) args.Icon),
|
||||
It.IsAny<Guid>()), Times.Once);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace SafeExamBrowser.Runtime.Communication
|
|||
switch (message)
|
||||
{
|
||||
case MessageBoxReplyMessage m:
|
||||
MessageBoxReplyReceived?.InvokeAsync(new MessageBoxReplyEventArgs { RequestId = m.RequestId/*// TODO , Result = m.Result*/ });
|
||||
MessageBoxReplyReceived?.InvokeAsync(new MessageBoxReplyEventArgs { RequestId = m.RequestId, Result = m.Result });
|
||||
return new SimpleResponse(SimpleResponsePurport.Acknowledged);
|
||||
case PasswordReplyMessage m:
|
||||
PasswordReceived?.InvokeAsync(new PasswordReplyEventArgs { Password = m.Password, RequestId = m.RequestId, Success = m.Success });
|
||||
|
|
|
@ -442,7 +442,7 @@ namespace SafeExamBrowser.Runtime
|
|||
}
|
||||
}
|
||||
|
||||
private MessageBoxResult ShowMessageBoxViaClient(string message, string title, MessageBoxAction confirm, MessageBoxIcon icon)
|
||||
private MessageBoxResult ShowMessageBoxViaClient(string message, string title, MessageBoxAction action, MessageBoxIcon icon)
|
||||
{
|
||||
var requestId = Guid.NewGuid();
|
||||
var result = MessageBoxResult.None;
|
||||
|
@ -459,12 +459,12 @@ namespace SafeExamBrowser.Runtime
|
|||
|
||||
runtimeHost.MessageBoxReplyReceived += responseEventHandler;
|
||||
|
||||
var communication = sessionContext.ClientProxy.ShowMessage(message, title, /*// TODO MessageBoxAction.Confirm, icon, */requestId);
|
||||
var communication = sessionContext.ClientProxy.ShowMessage(message, title, (int) action, (int) icon, requestId);
|
||||
|
||||
if (communication.Success)
|
||||
{
|
||||
responseEvent.WaitOne();
|
||||
// TODO result = response.Result;
|
||||
result = (MessageBoxResult) response.Result;
|
||||
}
|
||||
|
||||
runtimeHost.MessageBoxReplyReceived -= responseEventHandler;
|
||||
|
|
Loading…
Reference in a new issue