I hereby claim:
- I am huseyint on github.
- I am huseyint (https://keybase.io/huseyint) on keybase.
- I have a public key whose fingerprint is 38A9 7B2C AE48 E3B1 956C 50C4 DCDF E671 FDE8 6DC5
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
using System; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Runtime.Serialization.Formatters.Binary; | |
class Program | |
{ | |
static void Main() | |
{ | |
var formatter = new BinaryFormatter(); |
I hereby claim:
To claim this, I am signing this object:
// headers is a Dictionary<string, string> | |
Assert.AreEqual(1, headers.Count); | |
Assert.AreEqual("bar", headers["foo"]); | |
// Do I need both of these? Only first? Only second? | |
// Only 1st: What if the item is different than what I expected? | |
// Only 2nd: If dictionary is empty, this line will throw an exception before assertion is evaluated, is this OK? | |
// Both: Isn't this against "one assert per unit test" rule? |
public class FuncComparer<T, TKey> : IEqualityComparer<T> | |
{ | |
private readonly Func<T, TKey> _func; | |
public FuncComparer(Func<T, TKey> func) | |
{ | |
_func = func; | |
} | |
public bool Equals(T x, T y) |
// Shamelessly stolen and adapted from http://stackoverflow.com/questions/506096/comparing-object-properties-in-c | |
public static class Comparisons | |
{ | |
public static bool PublicInstancePropertiesEqual<T>(this T self, T to, params string[] ignore) where T : class | |
{ | |
if (self != null && to != null) | |
{ | |
var type = typeof(T); | |
foreach (var propertyName in type.GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance).Select(pi => pi.Name).Except(ignore)) | |
{ |