public void ThenTheDisposblesAreAllCalled() { int invokedCount = 0; var disposbale = Disposable.From(Disposable.From(() => invokedCount++), Disposable.From(() => invokedCount++)); disposbale.Dispose(); invokedCount.Should().Be(2); }
public void ThenTheActionIsInvoked() { bool invoked = false; var disposable = Disposable.From(() => invoked = true); disposable.Dispose(); invoked.Should().BeTrue(); }
public void ThenTheActionIsOnlyInvokedOnce() { int invokedCount = 0; var disposable = Disposable.From(() => invokedCount++); disposable.Dispose(); disposable.Dispose(); invokedCount.Should().Be(1); }
public byte[] Initiate(Byte[] token) { // If the token is null, supply a NULL pointer as the input var gssToken = token == null ? Disposable.From(default(GssBufferStruct)) : GssBuffer.FromBytes(token); var majorStatus = gss_init_sec_context( out var minorStatus, credentials, ref context, gssTargetName, ref GssSpnegoMechOidDesc, 0, 0, IntPtr.Zero, ref gssToken.Value, IntPtr.Zero, out var output, IntPtr.Zero, IntPtr.Zero ); switch (majorStatus) { case GSS_S_COMPLETE: IsEstablished = true; return(MarshalOutputToken(output)); case GSS_S_CONTINUE_NEEDED: return(MarshalOutputToken(output)); default: throw new GssException("The GSS Provider was unable to generate the supplied authentication token", majorStatus, minorStatus, GssSpnegoMechOidDesc); } }