Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 62f488dd12 | |||
| f13950e453 | |||
| 219611c821 |
@@ -195,7 +195,7 @@ public sealed class AlarmAckWriterTests
|
||||
RecordingAckServer server = new RecordingAckServer
|
||||
{
|
||||
AuthenticateResult = 5,
|
||||
AuthenticateException = new ArgumentException("bad credentials") { HResult = unchecked((int)0x80070057) },
|
||||
AuthenticateException = new HResultArgumentException("bad credentials", unchecked((int)0x80070057)),
|
||||
};
|
||||
using AlarmAckWriter writer = new AlarmAckWriter(server, new MxAccessWriteCompletionCache(), () => { }, TimeSpan.FromMilliseconds(10), "MxGateway");
|
||||
|
||||
@@ -225,11 +225,11 @@ public sealed class AlarmAckWriterTests
|
||||
RecordingAckServer server = new RecordingAckServer
|
||||
{
|
||||
AuthenticateResult = 5,
|
||||
AuthenticateException = new ArgumentException("not interop") { HResult = unchecked((int)0x80131500) },
|
||||
AuthenticateException = new HResultArgumentException("not interop", unchecked((int)0x80131500)),
|
||||
};
|
||||
using AlarmAckWriter writer = new AlarmAckWriter(server, new MxAccessWriteCompletionCache(), () => { }, TimeSpan.FromMilliseconds(10), "MxGateway");
|
||||
|
||||
Assert.Throws<ArgumentException>(() => writer.Acknowledge("T.A.AckMsg", "one", Alice()));
|
||||
Assert.Throws<HResultArgumentException>(() => writer.Acknowledge("T.A.AckMsg", "one", Alice()));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -424,6 +424,16 @@ public sealed class AlarmAckWriterTests
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>ArgumentException with an explicit HRESULT (the setter is protected on net48).</summary>
|
||||
internal sealed class HResultArgumentException : ArgumentException
|
||||
{
|
||||
public HResultArgumentException(string message, int hresult)
|
||||
: base(message)
|
||||
{
|
||||
HResult = hresult;
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class RecordingAckServer : IMxAccessServer
|
||||
{
|
||||
private int nextItemHandle = 100;
|
||||
|
||||
Reference in New Issue
Block a user