public void TestEqual() { var left = new Opaque(new byte[] { 0x80, 0x77 }); var right = new Opaque(new byte[] { 0x80, 0x77 }); Assert.AreEqual(left, right); }
public void FromExpression_Creates_Same_CustomAttributeInfo_As_Calling_The_Constructor( Opaque <Expression <Func <Attribute> > > expr, CustomAttributeInfo expected) { var actual = CustomAttributeInfo.FromExpression(expr.Value); Assert.AreEqual(expected, actual); }
public static Source CreateSource(int signum) { var ret_ = g_unix_signal_source_new(signum); var ret = Opaque.GetInstance <Source> (ret_, Transfer.Full); return(ret); }
static void UnmanagedClosureMarshal(IntPtr closure_, IntPtr returnValue_, uint nParamValues_, Value[] paramValues_, IntPtr invocationHint_, IntPtr marshalData_) { try { var closure = Opaque.GetInstance <Closure>(closure_, Transfer.None); var returnValue = default(Value); if (returnValue_ != IntPtr.Zero) { returnValue = Marshal.PtrToStructure <Value>(returnValue_); } SignalInvocationHint?invocationHint = null; if (invocationHint_ != IntPtr.Zero) { invocationHint = Marshal.PtrToStructure <SignalInvocationHint>(invocationHint_); } var gcHandle = (GCHandle)marshalData_; var marshalData = (UnmanagedClosureMarshalData)gcHandle.Target; marshalData.ClosureMarshal(closure, ref returnValue, paramValues_, invocationHint); if (returnValue_ != IntPtr.Zero) { Marshal.StructureToPtr <Value>(returnValue, returnValue_, false); } } catch (Exception ex) { ex.LogUnhandledException(); } }
public void TestConstructor() { Gauge32 e = new Gauge32(3); Opaque test = new Opaque(e.ToBytes()); Assert.AreEqual(new byte[] { 0x44, 0x03, 0x42, 0x01, 0x03 }, test.ToBytes()); }
public void Authenticate_TrueOnValidMembership() { string ipAddress = "127.0.0.1"; var configuration = CreateNewConfig(); var inspector = new DigestAuthenticator(configuration); //the result of MD5 hashing some well known values (either specified in the header below or similar) string response = "dc950f2d7c24037a6c775bcc9198b6f8"; //939e7578ed9e3c518a452acee763bce9:NjM0Mzc3MjI2OTIwMDA6Yjg3ZWZlODM0Mjc1NThjZGVlZWVkYjRjNTI1MzFjMzM=:00000001:0a4f113b:auth:39aff3a2bab6126f332b942af96d3366 NonceManager.Now = () => DateTime.Parse("4/6/2011 9:38:12 PM", CultureInfo.CurrentCulture); string nonce = NonceManager.Generate(ipAddress, privateHashEncoder); //this should generate very specific nonce "NjM0Mzc3MjI2OTIwMDA6Yjg3ZWZlODM0Mjc1NThjZGVlZWVkYjRjNTI1MzFjMzM=" var headers = new NameValueCollection() { { "Authorization", string.Format(CultureInfo.InvariantCulture, @"Digest username=""Mufasa"",realm=""{0}"", nonce=""{1}"", uri=""/dir/index.html"",qop=auth,nc=00000001,cnonce=""0a4f113b"", response=""{2}"", opaque=""{3}""", configuration.Realm, nonce, response, Opaque.Current()) } }; var result = inspector.Authenticate(CreateNewFakeContext(headers, ipAddress)); NonceManager.Now = () => { return(DateTime.UtcNow); }; Assert.True(result.Success); Assert.Equal(result.Principal.Identity.Name, "Mufasa"); }
public static Source CreateSourceSeconds(uint interval) { var ret_ = g_timeout_source_new_seconds(interval); var ret = Opaque.GetInstance <Source> (ret_, Transfer.Full); return(ret); }
public static Task <bool> CanReachAsync(this INetworkMonitor monitor, IntPtr connectable, IntPtr cancellable = default(IntPtr)) { if (monitor == null) { throw new ArgumentNullException(nameof(monitor)); } var instance = (Object)monitor; var completion = new TaskCompletionSource <bool> (); Action <IntPtr, IntPtr, IntPtr> nativeCallback = (sourceObjectPtr, resultPtr, userDataPtr) => { IntPtr errorPtr; var ret = g_network_monitor_can_reach_async_finish(sourceObjectPtr, resultPtr, out errorPtr); if (errorPtr != IntPtr.Zero) { var error = Opaque.GetInstance <Error> (errorPtr, Transfer.Full); completion.SetException(new GErrorException(error)); } else { completion.SetResult(ret); } GCHandle.FromIntPtr(userDataPtr).Free(); }; var callbackGCHandle = GCHandle.Alloc(nativeCallback); g_network_monitor_can_reach_async(instance.Handle, connectable, cancellable, nativeCallback, (IntPtr)callbackGCHandle); GC.KeepAlive(instance); return(completion.Task); }
static OpaqueInt getItemAt(PtrArray <OpaqueInt> array, int index) { var dataPtr = Marshal.ReadIntPtr(array.Handle); var data = Marshal.ReadIntPtr(dataPtr, IntPtr.Size * index); return(Opaque.GetInstance <OpaqueInt> (data, Transfer.None)); }
public LineSegment?CalculateFrontFace(Opaque opaque) { if (opaque.CrossSection(GetOrigin()) is LineSegment crossSec) { return(crossSec.Intersect(viewTriangle, .0001f)); } return(null); }
public void TestConstructor() { Gauge32 e = new Gauge32(3); Opaque test = new Opaque(e.ToBytes()); Assert.AreEqual(new byte[] {0x44, 0x03, 0x42, 0x01, 0x03}, test.ToBytes()); Assert.AreEqual("42 01 03", test.ToString()); Assert.Throws<ArgumentNullException>(() => test.AppendBytesTo(null)); }
public void TestConstructor() { Gauge32 e = new Gauge32(3); Opaque test = new Opaque(e.ToBytes()); Assert.AreEqual(new byte[] { 0x44, 0x03, 0x42, 0x01, 0x03 }, test.ToBytes()); Assert.AreEqual("42 01 03", test.ToString()); Assert.Throws <ArgumentNullException>(() => test.AppendBytesTo(null)); }
internal static T Get <T> (GType type) where T : TypeClass { if (!type.IsClassed) { throw new ArgumentException("GType is not classed", nameof(type)); } var handle = g_type_class_ref(type); var ret = Opaque.GetInstance <T> (handle, Transfer.Full); return(ret); }
public bool MoveNext() { AssertNotDisposed(); var ret_ = g_variant_iter_next_value(handle); if (ret_ == IntPtr.Zero) { return(false); } Current = Opaque.GetInstance <Variant> (ret_, Transfer.Full); return(true); }
public static Object New(GType objectType, params object[] parameters) { IntPtr errorPtr; var ret_ = g_initable_newv(objectType, 0, IntPtr.Zero, IntPtr.Zero, out errorPtr); if (errorPtr != IntPtr.Zero) { var error = Opaque.GetInstance <Error> (errorPtr, Transfer.Full); throw new GErrorException(error); } var ret = Object.GetInstance(ret_, Transfer.Full); return(ret); }
public override int GetHashCode() { var hashCode = -81208087; hashCode = hashCode * -1521134295 + Color.GetHashCode(); hashCode = hashCode * -1521134295 + PushReaction.GetHashCode(); hashCode = hashCode * -1521134295 + BlocksMovement.GetHashCode(); hashCode = hashCode * -1521134295 + Flammable.GetHashCode(); hashCode = hashCode * -1521134295 + RequiresNoTool.GetHashCode(); hashCode = hashCode * -1521134295 + Liquid.GetHashCode(); hashCode = hashCode * -1521134295 + Opaque.GetHashCode(); hashCode = hashCode * -1521134295 + Replaceable.GetHashCode(); hashCode = hashCode * -1521134295 + Solid.GetHashCode(); return(hashCode); }
private void CalculateShadowFaces(LightViewTriangle lightTriangle) { frontFacing.Clear(); leftFacing.Clear(); rightFacing.Clear(); for (int i = 0; i < sortedFrontFaces.Count; i++) { LineSegment?prevSeg = i == 0 ? (LineSegment?)null : sortedFrontFaces[i - 1].Item1; LineSegment?nextSeg = i == sortedFrontFaces.Count - 1 ? (LineSegment?)null : sortedFrontFaces[i + 1].Item1; LineSegment seg = sortedFrontFaces[i].Item1; Opaque opaque = sortedFrontFaces[i].Item2; if (opaque != null) { if (seg.Length() > .0001) { if (!frontFacing.ContainsKey(opaque)) { frontFacing.Add(opaque, new List <LineSegment>()); } frontFacing[opaque].Add(seg); } if (prevSeg is LineSegment prev) { LineSegment right = new LineSegment(prev.p2, seg.p1); if (right.Length() > .0001 && !right.GoesAwayFrom(lightTriangle.GetOrigin())) { rightFacing[opaque] = right; } } if (nextSeg is LineSegment next) { LineSegment left = new LineSegment(seg.p2, next.p1); if (left.Length() > .0001 && left.GoesAwayFrom(lightTriangle.GetOrigin())) { leftFacing[opaque] = left; } } } } var rightExtent = sortedFrontFaces[0].Item1.p1; var leftExtent = sortedFrontFaces[sortedFrontFaces.Count - 1].Item1.p2; rightmostFace = new LineSegment(lightTriangle.GetOrigin(), rightExtent); leftmostFace = new LineSegment(lightTriangle.GetOrigin(), leftExtent); }
public static extern void root(ref Opaque opaque, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p);
public void TestEqual() { var left = new Opaque(new byte[] { 0x80, 0x77 }); var right = new Opaque(new byte[] { 0x80, 0x77 }); Assert.AreEqual(left, right); // ReSharper disable RedundantCast Assert.AreEqual((Opaque)null, (Opaque)null); // ReSharper restore RedundantCast Assert.AreNotEqual(null, right); Assert.AreNotEqual(left, null); Assert.IsTrue(left != null); Assert.IsTrue(null != right); // ReSharper disable EqualExpressionComparison Assert.IsTrue((Opaque)null == (Opaque)null); // ReSharper restore EqualExpressionComparison Assert.IsTrue(left.Equals(right)); }
public static bool Init(this IInitable initable) { if (initable == null) { throw new ArgumentNullException(nameof(initable)); } var instance = (Object)initable; var ret = g_initable_init(instance.Handle, IntPtr.Zero, out var errorPtr); GC.KeepAlive(instance); if (errorPtr != IntPtr.Zero) { var error = Opaque.GetInstance <Error> (errorPtr, Transfer.Full); throw new GErrorException(error); } return(ret); }
/// <summary> /// Opens a module. /// </summary> /// <returns>A <see cref="Module"/>.</returns> /// <param name="fileName">The name of the file containing the module, /// or <c>null</c> to obtain a <see cref="Module"/> representing the main /// program itself.</param> /// <param name="flags">The flags used for opening the module. This can /// be the logical OR of any of the <see cref="ModuleFlags"/></param> /// <remarks> /// First of all <see cref="#ctor"/> tries to open <paramref name="fileName"/> /// as a module. If that fails and <paramref name="fileName"/> has the ".la"-suffix /// (and is a libtool archive) it tries to open the corresponding module. If /// that fails and it doesn't have the proper module suffix for the platform /// (<see cref="Suffix"/>), this suffix will be appended and the corresponding /// module will be opended. If that fails and <paramref name="fileName"/> doesn't /// have the ".la"-suffix, this suffix is appended and <see cref="#ctor"/> tries /// to open the corresponding module. If eventually that fails as well, /// a <see cref="ModuleErrorException"/> is thrown. /// </remarks> /// <exception cref="ModuleErrorException"> /// On failure /// </exception> public static Module Open(string fileName, ModuleFlags flags = 0) { var fileName_ = GMarshal.StringToUtf8Ptr(fileName); try { lock (errorLock) { var ret_ = g_module_open(fileName_, flags); if (ret_ == IntPtr.Zero) { throw new ModuleErrorException(Error); } var ret = Opaque.GetInstance <Module> (ret_, Transfer.Full); return(ret); } } finally { GMarshal.Free(fileName_); } }
public static bool CanReach(this INetworkMonitor monitor, IntPtr connectable, IntPtr cancellable = default(IntPtr)) { if (monitor == null) { throw new ArgumentNullException(nameof(monitor)); } var instance = (Object)monitor; var ret = g_network_monitor_can_reach(instance.Handle, connectable, cancellable, out var errorPtr); GC.KeepAlive(instance); if (errorPtr != IntPtr.Zero) { var error = Opaque.GetInstance <Error> (errorPtr, Transfer.Full); throw new GErrorException(error); } return(ret); }
public void TestEqual() { var left = new Opaque(new byte[] { 0x80, 0x77 }); var right = new Opaque(new byte[] { 0x80, 0x77 }); Assert.Equal(left, right); // ReSharper disable RedundantCast Assert.Equal((Opaque)null, (Opaque)null); // ReSharper restore RedundantCast #pragma warning disable xUnit2003 // Do not use equality check to test for null value Assert.NotEqual(null, right); #pragma warning disable xUnit2000 // Constants and literals should be the expected argument Assert.NotEqual(left, null); #pragma warning restore xUnit2000 // Constants and literals should be the expected argument #pragma warning restore xUnit2003 // Do not use equality check to test for null value Assert.True(left != null); Assert.True(null != right); // ReSharper disable EqualExpressionComparison Assert.True((Opaque)null == (Opaque)null); // ReSharper restore EqualExpressionComparison Assert.True(left.Equals(right)); Assert.False(left.Equals(1)); }
public Transparent(Opaque opaque, Color item) : base(item) { this.opaque = opaque; }
public Transparent(Opaque opaque) { this.opaque = opaque; }
// constructors public Transparent() { this.opaque = Opaque.A_ONE; }
static void TestOpaque () { Opaque op, op1; IntPtr handle; Console.WriteLine ("Testing Opaque new/free"); op = new Opaque (); if (!op.Owned) Error ("Newly-created Opaque is not Owned"); handle = op.Handle; op.Dispose (); op = new Opaque (handle); if (op.Owned) Error ("IntPtr-created Opaque is Owned"); if (Opaquetest.Error) Error ("Memory error after initial new/free."); Opaquetest.ExpectError = true; if (op.Serial != Opaque.LastSerial) Error ("Serial mismatch. Expected {0}, Got {1}", Opaque.LastSerial, op.Serial); if (!Opaquetest.Error) Error ("Opaque not properly freed."); op.Dispose (); if (Opaquetest.Error) Error ("Opaque created from IntPtr was freed by gtk#"); Console.WriteLine ("Testing Opaque copy/free"); op = new Opaque (); op1 = op.Copy (); handle = op1.Handle; op.Dispose (); op1.Dispose (); if (Opaquetest.Error) Error ("Memory error after initial copy/free."); op = new Opaque (handle); Opaquetest.ExpectError = true; if (op.Serial != Opaque.LastSerial) Error ("Serial mismatch. Expected {0}, Got {1}", Opaque.LastSerial, op.Serial); if (!Opaquetest.Error) Error ("Opaque not properly freed."); op.Dispose (); if (Opaquetest.Error) Error ("Opaque created from IntPtr was freed by gtk#"); Console.WriteLine ("Testing non-owned return."); op = new Opaque (); op1 = new Opaque (); op.Friend = op1; if (Opaquetest.Error) Error ("Memory error after setting op.Friend."); op1 = op.Friend; if (op1.Serial != Opaque.LastSerial || Opaquetest.Error) Error ("Error reading op.Friend. Expected {0}, Got {1}", Opaque.LastSerial, op1.Serial); if (!op1.Owned) Error ("op1 not Owned after being read off op.Friend"); op.Dispose (); op1.Dispose (); if (Opaquetest.Error) Error ("Memory error after freeing op and op1."); Console.WriteLine ("Testing returning a Gtk#-owned opaque from C# to C"); ret_op = new Opaque (); op = Opaque.Check (new Gtksharp.OpaqueReturnFunc (ReturnOpaque), new Gtksharp.GCFunc (GC)); if (op.Serial != Opaque.LastSerial || Opaquetest.Error) Error ("Error during Opaque.Check. Expected {0}, Got {1}", Opaque.LastSerial, op.Serial); op.Dispose (); if (Opaquetest.Error) Error ("Memory error after clearing op."); Console.WriteLine ("Testing returning a Gtk#-owned opaque to a C method that will free it"); ret_op = new Opaque (); op = Opaque.CheckFree (new Gtksharp.OpaqueReturnFunc (ReturnOpaque), new Gtksharp.GCFunc (GC)); if (Opaquetest.Error) Error ("Error during Opaque.CheckFree."); Opaquetest.ExpectError = true; if (op.Serial != Opaque.LastSerial) Error ("Error during Opaque.CheckFree. Expected {0}, Got {1}", Opaque.LastSerial, op.Serial); if (!Opaquetest.Error) Error ("Didn't get expected error accessing op.Serial!"); Opaquetest.ExpectError = true; op.Dispose (); if (!Opaquetest.Error) Error ("Didn't get expected double free on op after CheckFree!"); Console.WriteLine ("Testing leaking a C-owned opaque"); ret_op = new Opaque (); ret_op.Owned = false; op = Opaque.Check (new Gtksharp.OpaqueReturnFunc (ReturnOpaque), new Gtksharp.GCFunc (GC)); if (op.Serial != Opaque.LastSerial || Opaquetest.Error) Error ("Error during Opaque.Check. Expected {0}, Got {1}", Opaque.LastSerial, op.Serial); handle = op.Handle; op.Dispose (); if (Opaquetest.Error) Error ("Memory error after disposing op."); op = new Opaque (handle); if (op.Serial != Opaque.LastSerial || Opaquetest.Error) Error ("Failed to leak op. Expected {0}, Got {1}", Opaque.LastSerial, op.Serial); Console.WriteLine ("Testing handing over a C-owned opaque to a C method that will free it"); ret_op = new Opaque (); ret_op.Owned = false; op = Opaque.CheckFree (new Gtksharp.OpaqueReturnFunc (ReturnOpaque), new Gtksharp.GCFunc (GC)); if (Opaquetest.Error) Error ("Error during Opaque.CheckFree."); Opaquetest.ExpectError = true; if (op.Serial != Opaque.LastSerial) Error ("Error during Opaque.CheckFree. Expected {0}, Got {1}", Opaque.LastSerial, op.Serial); if (!Opaquetest.Error) Error ("Didn't get expected error accessing op.Serial!"); op.Dispose (); if (Opaquetest.Error) Error ("Double free on op!"); }
static void TestOpaque() { Opaque op, op1; IntPtr handle; Console.WriteLine("Testing Opaque new/free"); op = new Opaque(); if (!op.Owned) { Error("Newly-created Opaque is not Owned"); } handle = op.Handle; op.Dispose(); op = new Opaque(handle); if (op.Owned) { Error("IntPtr-created Opaque is Owned"); } if (Opaquetest.Error) { Error("Memory error after initial new/free."); } Opaquetest.ExpectError = true; if (op.Serial != Opaque.LastSerial) { Error("Serial mismatch. Expected {0}, Got {1}", Opaque.LastSerial, op.Serial); } if (!Opaquetest.Error) { Error("Opaque not properly freed."); } op.Dispose(); if (Opaquetest.Error) { Error("Opaque created from IntPtr was freed by gtk#"); } Console.WriteLine("Testing Opaque copy/free"); op = new Opaque(); op1 = op.Copy(); handle = op1.Handle; op.Dispose(); op1.Dispose(); if (Opaquetest.Error) { Error("Memory error after initial copy/free."); } op = new Opaque(handle); Opaquetest.ExpectError = true; if (op.Serial != Opaque.LastSerial) { Error("Serial mismatch. Expected {0}, Got {1}", Opaque.LastSerial, op.Serial); } if (!Opaquetest.Error) { Error("Opaque not properly freed."); } op.Dispose(); if (Opaquetest.Error) { Error("Opaque created from IntPtr was freed by gtk#"); } Console.WriteLine("Testing non-owned return."); op = new Opaque(); op1 = new Opaque(); op.Friend = op1; if (Opaquetest.Error) { Error("Memory error after setting op.Friend."); } op1 = op.Friend; if (op1.Serial != Opaque.LastSerial || Opaquetest.Error) { Error("Error reading op.Friend. Expected {0}, Got {1}", Opaque.LastSerial, op1.Serial); } if (!op1.Owned) { Error("op1 not Owned after being read off op.Friend"); } op.Dispose(); op1.Dispose(); if (Opaquetest.Error) { Error("Memory error after freeing op and op1."); } Console.WriteLine("Testing returning a Gtk#-owned opaque from C# to C"); ret_op = new Opaque(); op = Opaque.Check(new Gtksharp.OpaqueReturnFunc(ReturnOpaque), new Gtksharp.GCFunc(GC)); if (op.Serial != Opaque.LastSerial || Opaquetest.Error) { Error("Error during Opaque.Check. Expected {0}, Got {1}", Opaque.LastSerial, op.Serial); } op.Dispose(); if (Opaquetest.Error) { Error("Memory error after clearing op."); } Console.WriteLine("Testing returning a Gtk#-owned opaque to a C method that will free it"); ret_op = new Opaque(); op = Opaque.CheckFree(new Gtksharp.OpaqueReturnFunc(ReturnOpaque), new Gtksharp.GCFunc(GC)); if (Opaquetest.Error) { Error("Error during Opaque.CheckFree."); } Opaquetest.ExpectError = true; if (op.Serial != Opaque.LastSerial) { Error("Error during Opaque.CheckFree. Expected {0}, Got {1}", Opaque.LastSerial, op.Serial); } if (!Opaquetest.Error) { Error("Didn't get expected error accessing op.Serial!"); } Opaquetest.ExpectError = true; op.Dispose(); if (!Opaquetest.Error) { Error("Didn't get expected double free on op after CheckFree!"); } Console.WriteLine("Testing leaking a C-owned opaque"); ret_op = new Opaque(); ret_op.Owned = false; op = Opaque.Check(new Gtksharp.OpaqueReturnFunc(ReturnOpaque), new Gtksharp.GCFunc(GC)); if (op.Serial != Opaque.LastSerial || Opaquetest.Error) { Error("Error during Opaque.Check. Expected {0}, Got {1}", Opaque.LastSerial, op.Serial); } handle = op.Handle; op.Dispose(); if (Opaquetest.Error) { Error("Memory error after disposing op."); } op = new Opaque(handle); if (op.Serial != Opaque.LastSerial || Opaquetest.Error) { Error("Failed to leak op. Expected {0}, Got {1}", Opaque.LastSerial, op.Serial); } Console.WriteLine("Testing handing over a C-owned opaque to a C method that will free it"); ret_op = new Opaque(); ret_op.Owned = false; op = Opaque.CheckFree(new Gtksharp.OpaqueReturnFunc(ReturnOpaque), new Gtksharp.GCFunc(GC)); if (Opaquetest.Error) { Error("Error during Opaque.CheckFree."); } Opaquetest.ExpectError = true; if (op.Serial != Opaque.LastSerial) { Error("Error during Opaque.CheckFree. Expected {0}, Got {1}", Opaque.LastSerial, op.Serial); } if (!Opaquetest.Error) { Error("Didn't get expected error accessing op.Serial!"); } op.Dispose(); if (Opaquetest.Error) { Error("Double free on op!"); } }
//public override void Init(LightBase lightSource, Side illuminatedSide) { // Debug.Assert(false); //} public void Init(LightBase lightSource, Side illuminatedSide, Opaque caster) { base.Init(lightSource, illuminatedSide); this.caster = caster; }
public void OnAuthenticationFailure_RecognizesAndReportsStaleNonce() { HttpContextBase context = GetDefaultFakedContext(); var failureHandler = GetFailureHandler(); string nonce = NonceManager.Generate(ipAddress, privateHashEncoder); var headers = new NameValueCollection() { { "Authorization", string.Format(CultureInfo.InvariantCulture, @"Digest username=""Mufasa"",realm=""*****@*****.**"", nonce=""{0}"", uri=""/dir/index.html"",qop=auth,nc=00000001,cnonce=""0a4f113b"", response=""6629fae49393a05397450978507c4ef1"", opaque=""5ccc069c403ebaf9f0171e9517f40e41""", nonce) } }; A.CallTo(() => context.Request.Headers).Returns(headers); //jump ahead just outside the reach of our configuration DateTime now = DateTime.UtcNow; NonceManager.Now = () => now + failureHandler.Configuration.NonceValidDuration.Add(TimeSpan.FromSeconds(1)); //record the values from the AddHeader call and make sure they match our expectations string headerName = string.Empty, headerValue = string.Empty; A.CallTo(() => context.Response.AddHeader(A <string> .Ignored, A <string> .Ignored)) .Invokes(call => { headerName = (string)call.Arguments[0]; headerValue = (string)call.Arguments[1]; }); failureHandler.OnAuthenticationFailure(context, inspectorResults); string expectedHeader = String.Format(CultureInfo.InvariantCulture, "Digest realm=\"{0}\", nonce=\"{1}\", opaque=\"{2}\", stale=TRUE, algorithm=MD5, qop=\"auth\"", realm, NonceManager.Generate(ipAddress, privateHashEncoder), Opaque.Current()); ThawNonceClock(); Assert.True(headerName == "WWW-Authenticate" && expectedHeader == headerValue); }
public Value (Opaque val, string type_name) { type = IntPtr.Zero; pad1 = new Padding (); pad2 = new Padding (); g_value_init (ref this, GType.FromName (type_name).Val); g_value_set_boxed (ref this, val.Handle); }
public Value (IntPtr obj, string prop_name, Opaque val) { type = IntPtr.Zero; pad1 = new Padding (); pad2 = new Padding (); InitForProperty (Gst.GLib.Object.GetObject (obj), prop_name); g_value_set_boxed (ref this, val.Handle); }
public void TestConstructor() { Gauge32 e = new Gauge32(3); Opaque test = new Opaque(e.ToBytes()); Assert.AreEqual(new byte[] {0x44, 0x03, 0x42, 0x01, 0x03}, test.ToBytes()); }
public static extern void root(ref Opaque a, Normal b, NormalWithZST c, TupleRenamed d, TupleNamed e);
public void OnAuthenticationFailure_GeneratesCorrectHeaderForNewRequest() { FreezeNonceClock(); HttpContextBase context = GetDefaultFakedContext(); //record the values from the AddHeader call and make sure they match our expectations string headerName = string.Empty, headerValue = string.Empty; A.CallTo(() => context.Response.AddHeader(A <string> .Ignored, A <string> .Ignored)) .Invokes(call => { headerName = (string)call.Arguments[0]; headerValue = (string)call.Arguments[1]; }); var failureHandler = GetFailureHandler(); failureHandler.OnAuthenticationFailure(context, inspectorResults); string expectedHeader = String.Format(CultureInfo.InvariantCulture, "Digest realm=\"{0}\", nonce=\"{1}\", opaque=\"{2}\", stale=FALSE, algorithm=MD5, qop=\"auth\"", realm, NonceManager.Generate(ipAddress, privateHashEncoder), Opaque.Current()); ThawNonceClock(); Assert.Equal(headerName, "WWW-Authenticate"); Assert.Equal(expectedHeader, headerValue); }