Update SigComparer...

Update SigComparer...

- Add SubstituteGenericParameters option to enable MemberRef compares
  against MethodBase
- The CLR maps FnPtr to System.IntPtr. Update the code to make sure
  a FnPtr and a System.IntPtr compares equal when comparing our MethodSig
  to a MethodBase.

--- src/DotNet/SigComparer.cs
+++ src/DotNet/SigComparer.cs
@@ -400,7 +400,9 @@
 		CompareEventDeclaringType = 8,

 		/// <summary>
-		/// Compares parameters after a sentinel in method sigs
+		/// Compares parameters after a sentinel in method sigs. Should not be enabled when
+		/// comparing <see cref="MethodSig"/>s against <see cref="MethodInfo"/>s since it's
+		/// not possible to get those sentinel params from a <see cref="MethodInfo"/>.
 		/// </summary>
 		CompareSentinelParams = 0x10,

@@ -429,6 +431,15 @@
 		/// Don't compare a method/property's return type
 		/// </summary>
 		DontCompareReturnType = 0x200,
+
+		/// <summary>
+		/// If set, all generic parameters are replaced with their generic arguments prior
+		/// to comparing types. You should enable this when comparing a method, field, property
+		/// or an event to a <see cref="MethodInfo"/>, <see cref="FieldInfo"/>,
+		/// <see cref="PropertyInfo"/> or an <see cref="EventInfo"/> if the owner type could
+		/// be a generic instance type.
+		/// </summary>
+		SubstituteGenericParameters = 0x400,
 	}

 	/// <summary>
@@ -439,7 +450,6 @@
 		const int HASHCODE_MAGIC_NESTED_TYPE = -1049070942;
 		const int HASHCODE_MAGIC_ET_MODULE = -299744851;
 		const int HASHCODE_MAGIC_ET_VALUEARRAY = -674970533;
-		const int HASHCODE_MAGIC_ET_FNPTR = -1333778933;
 		const int HASHCODE_MAGIC_ET_GENERICINST = -2050514639;
 		const int HASHCODE_MAGIC_ET_VAR = 1288450097;
 		const int HASHCODE_MAGIC_ET_MVAR = -990598495;
@@ -449,8 +459,13 @@
 		const int HASHCODE_MAGIC_ET_PTR = 1976400808;
 		const int HASHCODE_MAGIC_ET_SENTINEL = 68439620;

+		// FnPtr is mapped to System.IntPtr, so use the same hash code for both
+		// IMPORTANT: This must match GetHashCode(TYPE)
+		static readonly int HASHCODE_MAGIC_ET_FNPTR_AND_I = UTF8String.GetHashCode(new UTF8String("System")) + UTF8String.GetHashCode(new UTF8String("IntPtr"));
+
 		RecursionCounter recursionCounter;
 		SigComparerOptions options;
+		GenericArguments genericArguments;

 		/// <summary>
 		/// Gets/sets the options
@@ -591,18 +606,54 @@
 		}

 		/// <summary>
+		/// Gets/sets the <see cref="SigComparerOptions.SubstituteGenericParameters"/> bit
+		/// </summary>
+		public bool SubstituteGenericParameters {
+			get { return (options & SigComparerOptions.SubstituteGenericParameters) != 0; }
+			set {
+				if (value)
+					options |= SigComparerOptions.SubstituteGenericParameters;
+				else
+					options &= ~SigComparerOptions.SubstituteGenericParameters;
+			}
+		}
+
+		/// <summary>
 		/// Constructor
 		/// </summary>
 		/// <param name="options">Comparison options</param>
 		public SigComparer(SigComparerOptions options) {
 			this.recursionCounter = new RecursionCounter();
 			this.options = options;
+			this.genericArguments = null;
 		}

 		SigComparerOptions ClearOptions(SigComparerOptions flags) {
 			var old = options;
 			options &= ~flags;
 			return old;
+		}
+
+		SigComparerOptions SetOptions(SigComparerOptions flags) {
+			var old = options;
+			options |= flags;
+			return old;
+		}
+
+		void RestoreOptions(SigComparerOptions oldFlags) {
+			options = oldFlags;
+		}
+
+		void InitializeGenericArguments() {
+			if (genericArguments == null)
+				genericArguments = new GenericArguments();
+		}
+
+		static GenericInstSig GetGenericInstanceType(IMemberRefParent parent) {
+			var ts = parent as TypeSpec;
+			if (ts == null)
+				return null;
+			return TypeSig.RemoveModifiers(ts.TypeSig) as GenericInstSig;
 		}

 		/// <summary>
@@ -1144,7 +1195,8 @@
 		/// <returns>The hash code</returns>
 		public int GetHashCode(TypeRef a) {
 			// ************************************************************************************
-			// IMPORTANT: This hash code must match the Type/TypeRef/TypeDef/ExportedType hash code
+			// IMPORTANT: This hash code must match the Type/TypeRef/TypeDef/ExportedType
+			// hash code and HASHCODE_MAGIC_ET_FNPTR_AND_I constant
 			// ************************************************************************************

 			// See GetHashCode(Type) for the reason why null returns GetHashCodeGlobalType()
@@ -1188,7 +1240,8 @@
 		/// <returns>The hash code</returns>
 		public int GetHashCode(ExportedType a) {
 			// ************************************************************************************
-			// IMPORTANT: This hash code must match the Type/TypeRef/TypeDef/ExportedType hash code
+			// IMPORTANT: This hash code must match the Type/TypeRef/TypeDef/ExportedType
+			// hash code and HASHCODE_MAGIC_ET_FNPTR_AND_I constant
 			// ************************************************************************************

 			// See GetHashCode(Type) for the reason why null returns GetHashCodeGlobalType()
@@ -1233,7 +1286,8 @@
 		/// <returns>The hash code</returns>
 		public int GetHashCode(TypeDef a) {
 			// ************************************************************************************
-			// IMPORTANT: This hash code must match the Type/TypeRef/TypeDef/ExportedType hash code
+			// IMPORTANT: This hash code must match the Type/TypeRef/TypeDef/ExportedType
+			// hash code and HASHCODE_MAGIC_ET_FNPTR_AND_I constant
 			// ************************************************************************************

 			// See GetHashCode(Type) for the reason why null returns GetHashCodeGlobalType()
@@ -1663,6 +1717,9 @@
 			if (!recursionCounter.Increment())
 				return 0;
 			int hash;
+
+			if (genericArguments != null)
+				a = genericArguments.Resolve(a);

 			switch (a.ElementType) {
 			case ElementType.Void:
@@ -1730,14 +1787,20 @@

 			case ElementType.GenericInst:
 				var gia = (GenericInstSig)a;
-				hash = HASHCODE_MAGIC_ET_GENERICINST + GetHashCode(gia.GenericType) + GetHashCode(gia.GenericArguments);
+				hash = HASHCODE_MAGIC_ET_GENERICINST;
+				if (SubstituteGenericParameters) {
+					InitializeGenericArguments();
+					genericArguments.PushTypeArgs(gia.GenericArguments);
+					hash += GetHashCode(gia.GenericType);
+					genericArguments.PopTypeArgs();
+				}
+				else
+					hash += GetHashCode(gia.GenericType);
+				hash += GetHashCode(gia.GenericArguments);
 				break;

 			case ElementType.FnPtr:
-				hash = HASHCODE_MAGIC_ET_FNPTR;
-				// Don't calculate the hash of the method signature since GetHashCode(Type)
-				// doesn't (and can't).
-				// hash += GetHashCode((a as FnPtrSig).Signature);
+				hash = HASHCODE_MAGIC_ET_FNPTR_AND_I;
 				break;

 			case ElementType.ValueArray:
@@ -1987,7 +2050,7 @@
 			if (!DontCompareReturnType)
 				hash += GetHashCode(a.RetType);
 			if (a.Generic)
-				hash += (int)a.GenParamCount;
+				hash += GetHashCode_ElementType_MVar((int)a.GenParamCount);
 			if (CompareSentinelParams)
 				hash += GetHashCode(a.ParamsAfterSentinel);

@@ -2331,8 +2394,16 @@
 			if (!recursionCounter.Increment())
 				return 0;

-			int hash = UTF8String.GetHashCode(a.Name) +
-					GetHashCode(a.Signature);
+			int hash = UTF8String.GetHashCode(a.Name);
+			GenericInstSig git;
+			if (SubstituteGenericParameters && (git = GetGenericInstanceType(a.Class)) != null) {
+				InitializeGenericArguments();
+				genericArguments.PushTypeArgs(git.GenericArguments);
+				hash += GetHashCode(a.Signature);
+				genericArguments.PopTypeArgs();
+			}
+			else
+				hash += GetHashCode(a.Signature);
 			if (CompareMethodFieldDeclaringType)
 				hash += GetHashCode(a.Class);

@@ -2374,7 +2445,17 @@
 			if (!recursionCounter.Increment())
 				return 0;

-			int hash = GetHashCode(a.Method) + GetHashCode(a.Instantiation);
+			// We must do this or it won't get the same hash code as some MethodInfos
+			var oldOptions = SetOptions(SigComparerOptions.SubstituteGenericParameters);
+			var gim = a.GenericInstMethodSig;
+			if (gim != null) {
+				InitializeGenericArguments();
+				genericArguments.PushMethodArgs(gim.GenericArguments);
+			}
+			int hash = GetHashCode(a.Method);
+			if (gim != null)
+				genericArguments.PopMethodArgs();
+			RestoreOptions(oldOptions);

 			recursionCounter.Decrement();
 			return hash;
@@ -2452,7 +2533,8 @@
 			}
 			MethodDef ma = a as MethodDef;
 			if (ma != null) {
-				hash = GetHashCode(ma);
+				// Only use the declaring type so we get the same hash code when hashing a MethodBase.
+				hash = GetHashCode(ma.DeclaringType);
 				goto exit;
 			}
 			hash = 0;
@@ -2959,10 +3041,8 @@

 		static bool IsCorLib(Assembly assembly) {
 			var asmName = assembly.GetName();
-			byte[] pkt;
 			return (asmName.Name == "mscorlib" || asmName.Name == "System.Runtime") &&
-					string.IsNullOrEmpty(asmName.CultureInfo.Name) &&
-					(pkt = asmName.GetPublicKeyToken()) != null && pkt.Length == 8;
+					string.IsNullOrEmpty(asmName.CultureInfo.Name);
 		}

 		/// <summary>
@@ -2983,6 +3063,9 @@
 			if (!recursionCounter.Increment())
 				return false;
 			bool result;
+
+			if (genericArguments != null)
+				a = genericArguments.Resolve(a);

 			switch (a.ElementType) {
 			case ElementType.Void:
@@ -3078,8 +3161,15 @@
 					break;
 				}
 				var gia = (GenericInstSig)a;
-				result = Equals(gia.GenericType, b.GetGenericTypeDefinition()) &&
-						Equals(gia.GenericArguments, b.GetGenericArguments());
+				if (SubstituteGenericParameters) {
+					InitializeGenericArguments();
+					genericArguments.PushTypeArgs(gia.GenericArguments);
+					result = Equals(gia.GenericType, b.GetGenericTypeDefinition());
+					genericArguments.PopTypeArgs();
+				}
+				else
+					result = Equals(gia.GenericType, b.GetGenericTypeDefinition());
+				result = result && Equals(gia.GenericArguments, b.GetGenericArguments());
 				break;

 			case ElementType.CModReqd:
@@ -3224,23 +3314,27 @@
 				hash = GetHashCode_TypeDef(a);
 				break;

+			case ElementType.FnPtr:
+				hash = HASHCODE_MAGIC_ET_FNPTR_AND_I;
+				break;
+
 			case ElementType.Sentinel:
 				hash = HASHCODE_MAGIC_ET_SENTINEL;
 				break;

 			case ElementType.Ptr:
 				hash = HASHCODE_MAGIC_ET_PTR +
-					(IsFnPtrElementType(a) ? HASHCODE_MAGIC_ET_FNPTR : GetHashCode(a.GetElementType()));
+					(IsFnPtrElementType(a) ? HASHCODE_MAGIC_ET_FNPTR_AND_I : GetHashCode(a.GetElementType()));
 				break;

 			case ElementType.ByRef:
 				hash = HASHCODE_MAGIC_ET_BYREF +
-					(IsFnPtrElementType(a) ? HASHCODE_MAGIC_ET_FNPTR : GetHashCode(a.GetElementType()));
+					(IsFnPtrElementType(a) ? HASHCODE_MAGIC_ET_FNPTR_AND_I : GetHashCode(a.GetElementType()));
 				break;

 			case ElementType.SZArray:
 				hash = HASHCODE_MAGIC_ET_SZARRAY +
-					(IsFnPtrElementType(a) ? HASHCODE_MAGIC_ET_FNPTR : GetHashCode(a.GetElementType()));
+					(IsFnPtrElementType(a) ? HASHCODE_MAGIC_ET_FNPTR_AND_I : GetHashCode(a.GetElementType()));
 				break;

 			case ElementType.CModReqd:
@@ -3253,7 +3347,7 @@
 				// The type doesn't store sizes and lower bounds, so can't use them to
 				// create the hash
 				hash = HASHCODE_MAGIC_ET_ARRAY + a.GetArrayRank() +
-					(IsFnPtrElementType(a) ? HASHCODE_MAGIC_ET_FNPTR : GetHashCode(a.GetElementType()));
+					(IsFnPtrElementType(a) ? HASHCODE_MAGIC_ET_FNPTR_AND_I : GetHashCode(a.GetElementType()));
 				break;

 			case ElementType.Var:
@@ -3268,7 +3362,6 @@
 				hash = HASHCODE_MAGIC_ET_GENERICINST + GetHashCode(a.GetGenericTypeDefinition()) + GetHashCode(a.GetGenericArguments());
 				break;

-			case ElementType.FnPtr:	// mapped to System.IntPtr
 			case ElementType.ValueArray:
 			case ElementType.Module:
 			case ElementType.End:
@@ -3302,6 +3395,36 @@
 				hash = (hash << 13) | (hash >> 19);
 			}
 			recursionCounter.Decrement();
+			return (int)hash;
+		}
+
+		/// <summary>
+		/// Gets the hash code of a list with only generic type parameters (<see cref="ElementType.Var"/>)
+		/// </summary>
+		/// <param name="numGenericParams">Number of generic type parameters</param>
+		/// <returns>Hash code</returns>
+		static int GetHashCode_ElementType_Var(int numGenericParams) {
+			return GetHashCode(numGenericParams, HASHCODE_MAGIC_ET_VAR);
+		}
+
+		/// <summary>
+		/// Gets the hash code of a list with only generic method parameters (<see cref="ElementType.MVar"/>)
+		/// </summary>
+		/// <param name="numGenericParams">Number of generic method parameters</param>
+		/// <returns>Hash code</returns>
+		static int GetHashCode_ElementType_MVar(int numGenericParams) {
+			return GetHashCode(numGenericParams, HASHCODE_MAGIC_ET_MVAR);
+		}
+
+		static int GetHashCode(int numGenericParams, int etypeHashCode) {
+			//************************************************************************
+			// IMPORTANT: This code must match any other GetHashCode(IList<SOME_TYPE>)
+			//************************************************************************
+			uint hash = 0;
+			for (int i = 0; i < numGenericParams; i++) {
+				hash += (uint)(etypeHashCode + i);
+				hash = (hash << 13) | (hash >> 19);
+			}
 			return (int)hash;
 		}

@@ -3358,7 +3481,8 @@
 		/// <returns>The hash code</returns>
 		public int GetHashCode_TypeDef(Type a) {
 			// ************************************************************************************
-			// IMPORTANT: This hash code must match the Type/TypeRef/TypeDef/ExportedType hash code
+			// IMPORTANT: This hash code must match the Type/TypeRef/TypeDef/ExportedType
+			// hash code and HASHCODE_MAGIC_ET_FNPTR_AND_I constant
 			// ************************************************************************************

 			// A global method/field's declaring type is null. This is the reason we must
@@ -3625,8 +3749,9 @@

 			var amSig = a.MethodSig;
 			bool result = UTF8String.ToSystemStringOrEmpty(a.Name) == b.Name &&
-					amSig != null && amSig.Generic == b.IsGenericMethodDefinition &&
-					Equals(amSig, b) &&
+					((amSig.Generic && b.IsGenericMethodDefinition && b.IsGenericMethod) ||
+					(!amSig.Generic && !b.IsGenericMethodDefinition && !b.IsGenericMethod)) &&
+					amSig != null && Equals(amSig, b) &&
 					(!CompareMethodFieldDeclaringType || Equals(a.DeclaringType, b.DeclaringType));

 			recursionCounter.Decrement();
@@ -3689,15 +3814,60 @@
 				return false;
 			if (!recursionCounter.Increment())
 				return false;
-
-			var amSig = a.MethodSig;
-			bool result = UTF8String.ToSystemStringOrEmpty(a.Name) == b.Name &&
-					amSig != null && amSig.Generic == b.IsGenericMethodDefinition &&
-					Equals(amSig, b) &&
-					(!CompareMethodFieldDeclaringType || Equals(a.Class, b.DeclaringType, b.Module));
-
-			recursionCounter.Decrement();
-			return result;
+			bool result;
+
+			if (b.IsGenericMethod && !b.IsGenericMethodDefinition) {
+				// 'a' must be a method ref in a generic type. This comparison must match
+				// the MethodSpec vs MethodBase comparison code.
+				result = a.IsMethodRef && a.MethodSig.Generic;
+
+				var oldOptions = ClearOptions(SigComparerOptions.CompareMethodFieldDeclaringType);
+				result = result && Equals(a, b.Module.ResolveMethod(b.MetadataToken));
+				RestoreOptions(oldOptions);
+				result = result && DeclaringTypeEquals(a, b);
+
+				result = result && GenericMethodArgsEquals((int)a.MethodSig.GenParamCount, b.GetGenericArguments());
+			}
+			else {
+				var amSig = a.MethodSig;
+				result = UTF8String.ToSystemStringOrEmpty(a.Name) == b.Name &&
+						((amSig.Generic && b.IsGenericMethodDefinition && b.IsGenericMethod) ||
+						(!amSig.Generic && !b.IsGenericMethodDefinition && !b.IsGenericMethod)) &&
+						amSig != null;
+
+				GenericInstSig git;
+				if (SubstituteGenericParameters && (git = GetGenericInstanceType(a.Class)) != null) {
+					InitializeGenericArguments();
+					genericArguments.PushTypeArgs(git.GenericArguments);
+					result = result && Equals(amSig, b);
+					genericArguments.PopTypeArgs();
+				}
+				else {
+					result = result && Equals(amSig, b);
+				}
+
+				result = result && (!CompareMethodFieldDeclaringType || Equals(a.Class, b.DeclaringType, b.Module));
+			}
+
+			recursionCounter.Decrement();
+			return result;
+		}
+
+		/// <summary>
+		/// Compares generic method args, making sure <paramref name="methodGenArgs"/> only
+		/// contains <see cref="ElementType.MVar"/>s.
+		/// </summary>
+		/// <param name="numMethodArgs">Number of generic method args in method #1</param>
+		/// <param name="methodGenArgs">Generic method args in method #2</param>
+		/// <returns><c>true</c> if same, <c>false</c> otherwise</returns>
+		bool GenericMethodArgsEquals(int numMethodArgs, IList<Type> methodGenArgs) {
+			if (numMethodArgs != methodGenArgs.Count)
+				return false;
+			for (int i = 0; i < numMethodArgs; i++) {
+				if (GetElementType(methodGenArgs[i]) != ElementType.MVar)
+					return false;
+			}
+			return true;
 		}

 		bool Equals(IMemberRefParent a, Type b, Module bModule) {
@@ -3724,7 +3894,7 @@
 			}
 			MethodDef ma = a as MethodDef;
 			if (ma != null) {
-				result = false;	//TODO: Compare ma with some method
+				result = Equals(ma.DeclaringType, b);
 				goto exit;
 			}
 			var td = a as TypeDef;
@@ -3768,12 +3938,13 @@

 			// Don't compare declaring types yet because the resolved method has the wrong
 			// declaring type (its declaring type is a generic type def).
+			// NOTE: We must not push generic method args when comparing a.Method
 			var oldOptions = ClearOptions(SigComparerOptions.CompareMethodFieldDeclaringType);
 			result = result && Equals(a.Method, b.Module.ResolveMethod(b.MetadataToken));
-			options = oldOptions;
+			RestoreOptions(oldOptions);
 			result = result && DeclaringTypeEquals(a.Method, b);

-			GenericInstMethodSig gim = a.GenericInstMethodSig;
+			var gim = a.GenericInstMethodSig;
 			result = result && gim != null && Equals(gim.GenericArguments, b.GetGenericArguments());

 			recursionCounter.Decrement();
@@ -3791,29 +3962,13 @@
 			if (!recursionCounter.Increment())
 				return 0;

-			int hash;
-			if (a.IsGenericMethod && !a.IsGenericMethodDefinition) {
-				// MethodSpec
-				// *************************************************************
-				// IMPORTANT: This hash code must match the MethodSpec hash code
-				// *************************************************************
-				var oldOptions = ClearOptions(SigComparerOptions.CompareMethodFieldDeclaringType);
-				hash = GetHashCode(a.Module.ResolveMethod(a.MetadataToken));
-				options = oldOptions;
-				if (CompareMethodFieldDeclaringType)
-					hash += GetHashCode(a.DeclaringType);
-				hash += GetHashCode(a.GetGenericArguments());
-			}
-			else {
-				// MethodDef
-				// *************************************************************
-				// IMPORTANT: This hash code must match the MemberRef hash code
-				// *************************************************************
-				hash = UTF8String.GetHashCode(new UTF8String(a.Name)) +
-						GetHashCode_MethodSig(a);
-				if (CompareMethodFieldDeclaringType)
-					hash += GetHashCode(a.DeclaringType);
-			}
+			// ***********************************************************************
+			// IMPORTANT: This hash code must match the MemberRef/MethodSpec hash code
+			// ***********************************************************************
+			int hash = UTF8String.GetHashCode(new UTF8String(a.Name)) +
+					GetHashCode_MethodSig(a);
+			if (CompareMethodFieldDeclaringType)
+				hash += GetHashCode(a.DeclaringType);

 			recursionCounter.Decrement();
 			return hash;
@@ -3826,12 +3981,12 @@
 				return 0;
 			int hash;

-			hash = GetHashCode_CallingConvention(a.CallingConvention, a.IsGenericMethodDefinition) +
+			hash = GetHashCode_CallingConvention(a.CallingConvention, a.IsGenericMethod) +
 					GetHashCode(a.GetParameters(), a.DeclaringType);
 			if (!DontCompareReturnType)
 				hash += GetHashCode_ReturnType(a);
-			if (a.IsGenericMethodDefinition)
-				hash += a.GetGenericArguments().Length;
+			if (a.IsGenericMethod)
+				hash += GetHashCode_ElementType_MVar(a.GetGenericArguments().Length);

 			recursionCounter.Decrement();
 			return hash;


adding translatable to a string in Editors/CropEditor.cs

svn path=/trunk/; revision=4421

--- src/Editors/CropEditor.cs
+++ src/Editors/CropEditor.cs
@@ -70,7 +70,7 @@
 		public override Widget ConfigurationWidget () {
 			VBox vbox = new VBox ();

-			Label info = new Label("Select the area that needs cropping.");
+			Label info = new Label (Catalog.GetString ("Select the area that needs cropping."));

 			constraints_combo = new ComboBox ();
 			CellRendererText constraint_name_cell = new CellRendererText ();


Small cleanup on UdpTraceListener.

Small cleanup on UdpTraceListener.

--- UdpTraceListenerUnitTests/TestUdpTraceListener.cs
+++ UdpTraceListenerUnitTests/TestUdpTraceListener.cs
@@ -1,11 +1,10 @@
-using System.Net.Sockets;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Splunk.Logging;
+using System.Diagnostics;
 using System.Net;
-using System.Diagnostics;
+using System.Net.Sockets;
 using System.Text;
 using System.Threading;
-using Splunk.Logging;
-using System.Threading.Tasks;
-using Microsoft.VisualStudio.TestTools.UnitTesting;

 namespace UdpTraceListenerUnitTests
 {
@@ -15,13 +14,13 @@
         [TestMethod]
         public void TraceToOpenUdpSocketWorks()
         {
-            StringBuilder sb = new StringBuilder();
+            var sb = new StringBuilder();
             var receivingUdpClient = new UdpClient(0);
             int port = ((IPEndPoint)receivingUdpClient.Client.LocalEndPoint).Port;

             var receiver = new Thread((object r) =>
             {
-                IPEndPoint endpoint = new IPEndPoint(IPAddress.Loopback, port);
+                var endpoint = new IPEndPoint(IPAddress.Loopback, port);
                 var receivedBytes = receivingUdpClient.Receive(ref endpoint);
                 ((StringBuilder)r).Append(Encoding.UTF8.GetString(receivedBytes));
             });


Amend.

Amend.

--- ValidCode/DependencyProperties/GenericNullable.cs
+++ ValidCode/DependencyProperties/GenericNullable.cs
@@ -11,12 +11,14 @@
             nameof(Value),
             typeof(T?),
             typeof(GenericNullable<T>),
-            new PropertyMetadata(default(T?), OnValueChanged));
+            new PropertyMetadata(
+                default(T?),
+                OnValueChanged));

         public T? Value
         {
-            get { return (T?)this.GetValue(ValueProperty); }
-            set { this.SetValue(ValueProperty, value); }
+            get => (T?)this.GetValue(ValueProperty);
+            set => this.SetValue(ValueProperty, value);
         }

         private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)


Attempt to get the self link

Attempt to get the self link

--- WebCrawlCleanup/run.csx
+++ WebCrawlCleanup/run.csx
@@ -55,7 +55,8 @@
 		{
 			foreach (CrawlResults doc in await results.ExecuteNextAsync())
 			{
-				log.Info($"Deleting document {0}", doc.id);
+				log.Info($"Deleting document {0}", doc.Id);
+				log.Info($"Selflink = {0}", ((Document)doc).SelfLink);
 				//await client.DeleteDocumentAsync(doc.SelfLink);
 			}
 		}


#1230 Наработки по переходу на FluentAssertions

--- VkNet.Tests/Categories/Users/UsersCategoryTest.cs
+++ VkNet.Tests/Categories/Users/UsersCategoryTest.cs
@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+using FluentAssertions;
 using Moq;
 using NUnit.Framework;
 using VkNet.Enums;
@@ -15,7 +16,6 @@
 namespace VkNet.Tests.Categories.Users
 {
 	[TestFixture]
-
 	public class UsersCategoryTest : CategoryBaseTest
 	{
 		protected override string Folder => "Users";
@@ -37,22 +37,22 @@
 				.FirstOrDefault();

 			// assert
-			Assert.That(user, Is.Not.Null);
-			Assert.That(user.Id, Is.EqualTo(1));
-			Assert.That(user.FirstName, Is.EqualTo("Павел"));
-			Assert.That(user.LastName, Is.EqualTo("Дуров"));
-			Assert.That(user.Counters, Is.Not.Null);
-			Assert.That(user.Counters.Albums, Is.EqualTo(1));
-			Assert.That(user.Counters.Videos, Is.EqualTo(8));
-			Assert.That(user.Counters.Audios, Is.EqualTo(0));
-			Assert.That(user.Counters.Notes, Is.EqualTo(6));
-			Assert.That(user.Counters.Photos, Is.EqualTo(153));
-			Assert.That(user.Counters.Friends, Is.EqualTo(689));
-			Assert.That(user.Counters.OnlineFriends, Is.EqualTo(85));
-			Assert.That(user.Counters.MutualFriends, Is.EqualTo(0));
-			Assert.That(user.Counters.Followers, Is.EqualTo(5937280));
-			Assert.That(user.Counters.Subscriptions, Is.EqualTo(0));
-			Assert.That(user.Counters.Pages, Is.EqualTo(51));
+			user.Should().NotBeNull();
+			user.Id.Should().Be(1);
+			user.FirstName.Should().Be("Павел");
+			user.LastName.Should().Be("Дуров");
+			user.Counters.Should().NotBeNull();
+			user.Counters.Albums.Should().Be(1);
+			user.Counters.Videos.Should().Be(8);
+			user.Counters.Audios.Should().Be(0);
+			user.Counters.Notes.Should().Be(6);
+			user.Counters.Photos.Should().Be(153);
+			user.Counters.Friends.Should().Be(689);
+			user.Counters.OnlineFriends.Should().Be(85);
+			user.Counters.MutualFriends.Should().Be(0);
+			user.Counters.Followers.Should().Be(5937280);
+			user.Counters.Subscriptions.Should().Be(0);
+			user.Counters.Pages.Should().Be(51);
 		}

 		[Test]
@@ -69,9 +69,9 @@
 				.FirstOrDefault();

 			// assert
-			Assert.That(user.Id, Is.EqualTo(1));
-			Assert.That(user.FirstName, Is.EqualTo("Павел"));
-			Assert.That(user.LastName, Is.EqualTo("Дуров"));
+			user.Id.Should().Be(1);
+			user.FirstName.Should().Be("Павел");
+			user.LastName.Should().Be("Дуров");
 		}

 		[Test]
@@ -87,13 +87,13 @@
 					ProfileFields.FirstName|ProfileFields.LastName|ProfileFields.Education)
 				.FirstOrDefault();

-			Assert.That(user, Is.Not.Null);
-
-			Assert.That(user.Id, Is.EqualTo(4793858));
-			Assert.That(user.FirstName, Is.EqualTo("Антон"));
-			Assert.That(user.LastName, Is.EqualTo("Жидков"));
-			Assert.That(user.Deactivated, Is.EqualTo(Deactivated.Deleted));
-			Assert.That(user.IsDeactivated, Is.True);
+			user.Should().NotBeNull();
+
+			user.Id.Should().Be(4793858);
+			user.FirstName.Should().Be("Антон");
+			user.LastName.Should().Be("Жидков");
+			user.Deactivated.Should().Be(Deactivated.Deleted);
+			user.IsDeactivated.Should().BeTrue();
 		}

 		[Test]
@@ -112,14 +112,14 @@
 					NameCase.Gen)
 				.FirstOrDefault();

-			Assert.That(user, Is.Not.Null);
-
-			Assert.That(user.Id, Is.EqualTo(53083705));
-			Assert.That(user.FirstName, Is.EqualTo("Дмитрия"));
-			Assert.That(user.LastName, Is.EqualTo("Медведева"));
-			Assert.That(user.Sex, Is.EqualTo(Sex.Male));
-			Assert.That(user.City.Id, Is.EqualTo(1));
-			Assert.That(user.City.Title, Is.EqualTo("Москва"));
+			user.Should().NotBeNull();
+
+			user.Id.Should().Be(53083705);
+			user.FirstName.Should().Be("Дмитрия");
+			user.LastName.Should().Be("Медведева");
+			user.Sex.Should().Be(Sex.Male);
+			user.City.Id.Should().Be(1);
+			user.City.Title.Should().Be("Москва");
 		}

 		[Test]
@@ -137,34 +137,34 @@
 			var fields = ProfileFields.FirstName|ProfileFields.LastName|ProfileFields.Sex|ProfileFields.City;
 			var users = Api.Users.Get(screenNames, fields, NameCase.Gen);

-			Assert.That(users, Is.Not.Null);
-			Assert.That(users.Count, Is.EqualTo(2));
+			users.Should().NotBeNull();
+			users.Should().HaveCount(2);

 			var user = users.FirstOrDefault();
-			Assert.That(user, Is.Not.Null);
-
-			Assert.That(user.Id, Is.EqualTo(53083705));
-			Assert.That(user.FirstName, Is.EqualTo("Дмитрия"));
-			Assert.That(user.LastName, Is.EqualTo("Медведева"));
-			Assert.That(user.Sex, Is.EqualTo(Sex.Male));
-			Assert.That(user.City.Id, Is.EqualTo(1));
-			Assert.That(user.City.Title, Is.EqualTo("Москва"));
+			user.Should().NotBeNull();
+
+			user.Id.Should().Be(53083705);
+			user.FirstName.Should().Be("Дмитрия");
+			user.LastName.Should().Be("Медведева");
+			user.Sex.Should().Be(Sex.Male);
+			user.City.Id.Should().Be(1);
+			user.City.Title.Should().Be("Москва");

 			var user1 = users.Skip(1).FirstOrDefault();
-			Assert.That(user1, Is.Not.Null);
-			Assert.That(user1.Id, Is.EqualTo(1));
-			Assert.That(user1.FirstName, Is.EqualTo("Павла"));
-			Assert.That(user1.LastName, Is.EqualTo("Дурова"));
-			Assert.That(user1.Sex, Is.EqualTo(Sex.Male));
-			Assert.That(user1.City.Id, Is.EqualTo(2));
-			Assert.That(user1.City.Title, Is.EqualTo("Санкт-Петербург"));
+			user1.Should().NotBeNull();
+			user1.Id.Should().Be(1);
+			user1.FirstName.Should().Be("Павла");
+			user1.LastName.Should().Be("Дурова");
+			user1.Sex.Should().Be(Sex.Male);
+			user1.City.Id.Should().Be(2);
+			user1.City.Title.Should().Be("Санкт-Петербург");
 		}

 		[Test]
 		public void Get_EmptyListOfUids_ThrowArgumentNullException()
 		{
 			IEnumerable<long> userIds = null;
-			Assert.That(() => Api.Users.Get(userIds), Throws.InstanceOf<ArgumentNullException>());
+			FluentActions.Invoking(() => Api.Users.Get(userIds)).Should().ThrowExactly<ArgumentNullException>();
 		}

 		[Test]
@@ -180,89 +180,89 @@
 				ProfileFields.All,
 				NameCase.Gen);

-			Assert.That(result, Is.Not.Null);
-			Assert.That(result.Count, Is.EqualTo(1));
+			result.Should().NotBeNull();
+			result.Should().ContainSingle();

 			var user = result.FirstOrDefault();
-			Assert.That(user, Is.Not.Null);
-			Assert.That(user.Id, Is.EqualTo(1));
-			Assert.That(user.FirstName, Is.EqualTo("Павла"));
-			Assert.That(user.LastName, Is.EqualTo("Дурова"));
-			Assert.That(user.Sex, Is.EqualTo(Sex.Male));
-			Assert.That(user.Nickname, Is.EqualTo(string.Empty));
-			Assert.That(user.Domain, Is.EqualTo("durov"));
-			Assert.That(user.BirthDate, Is.EqualTo("10.10.1984"));
-			Assert.That(user.City, Is.Not.Null);
-			Assert.That(user.City.Id, Is.EqualTo(2));
-			Assert.That(user.City.Title, Is.EqualTo("Санкт-Петербург"));
-			Assert.That(user.Country, Is.Not.Null);
-			Assert.That(user.Country.Id, Is.EqualTo(1));
-			Assert.That(user.Country.Title, Is.EqualTo("Россия"));
-			Assert.That(user.Timezone, Is.EqualTo(3));
-
-			Assert.That(user.PhotoPreviews.Photo50, Is.EqualTo(new Uri("http://cs7004.vk.me/c7003/v7003079/374b/53lwetwOxD8.jpg")));
-
-			Assert.That(user.PhotoPreviews.Photo100, Is.EqualTo(new Uri("http://cs7004.vk.me/c7003/v7003563/359e/Hei0g6eeaAc.jpg")));
-
-			Assert.That(user.PhotoPreviews.Photo200, Is.EqualTo(new Uri("http://cs7004.vk.me/c7003/v7003237/369a/x4RqtBxY4kc.jpg")));
-
-			Assert.That(user.PhotoPreviews.Photo400, Is.EqualTo(new Uri("http://cs7004.vk.me/c7003/v7003397/3824/JjPJbkvJxpM.jpg")));
-
-			Assert.That(user.PhotoPreviews.PhotoMax, Is.EqualTo(new Uri("http://cs7004.vk.me/c7003/v7003237/369a/x4RqtBxY4kc.jpg")));
-
-			Assert.That(user.HasMobile.HasValue, Is.True);
-			Assert.That(user.HasMobile.Value, Is.True);
-			Assert.That(user.Online.HasValue, Is.True);
-			Assert.That(user.Online.Value, Is.True);
-			Assert.That(user.CanPost, Is.False);
-			Assert.That(user.CanSeeAllPosts, Is.False);
-			Assert.That(user.CanSeeAudio, Is.False);
-			Assert.That(user.CanWritePrivateMessage, Is.False);
-			Assert.That(user.Connections.Twitter, Is.EqualTo("durov"));
-			Assert.That(user.Site, Is.EqualTo(string.Empty));
-			Assert.That(user.Status, Is.EqualTo(string.Empty));
+			user.Should().NotBeNull();
+			user.Id.Should().Be(1);
+			user.FirstName.Should().Be("Павла");
+			user.LastName.Should().Be("Дурова");
+			user.Sex.Should().Be(Sex.Male);
+			user.Nickname.Should().Be(string.Empty);
+			user.Domain.Should().Be("durov");
+			user.BirthDate.Should().Be("10.10.1984");
+			user.City.Should().NotBeNull();
+			user.City.Id.Should().Be(2);
+			user.City.Title.Should().Be("Санкт-Петербург");
+			user.Country.Should().NotBeNull();
+			user.Country.Id.Should().Be(1);
+			user.Country.Title.Should().Be("Россия");
+			user.Timezone.Should().Be(3);
+
+			user.PhotoPreviews.Photo50.Should().Be(new Uri("http://cs7004.vk.me/c7003/v7003079/374b/53lwetwOxD8.jpg"));
+
+			user.PhotoPreviews.Photo100.Should().Be(new Uri("http://cs7004.vk.me/c7003/v7003563/359e/Hei0g6eeaAc.jpg"));
+
+			user.PhotoPreviews.Photo200.Should().Be(new Uri("http://cs7004.vk.me/c7003/v7003237/369a/x4RqtBxY4kc.jpg"));
+
+			user.PhotoPreviews.Photo400.Should().Be(new Uri("http://cs7004.vk.me/c7003/v7003397/3824/JjPJbkvJxpM.jpg"));
+
+			user.PhotoPreviews.PhotoMax.Should().Be(new Uri("http://cs7004.vk.me/c7003/v7003237/369a/x4RqtBxY4kc.jpg"));
+
+			user.HasMobile.HasValue.Should().BeTrue();
+			user.HasMobile.Value.Should().BeTrue();
+			user.Online.HasValue.Should().BeTrue();
+			user.Online.Value.Should().BeTrue();
+			user.CanPost.Should().BeFalse();
+			user.CanSeeAllPosts.Should().BeFalse();
+			user.CanSeeAudio.Should().BeFalse();
+			user.CanWritePrivateMessage.Should().BeFalse();
+			user.Connections.Twitter.Should().Be("durov");
+			user.Site.Should().BeEmpty();
+			user.Status.Should().BeEmpty();

 			// TODO: u.LastSeen
-			Assert.That(user.CommonCount.Value, Is.EqualTo(0));
-			Assert.That(user.Counters.Albums, Is.EqualTo(1));
-			Assert.That(user.Counters.Videos, Is.EqualTo(8));
-			Assert.That(user.Counters.Audios, Is.EqualTo(0));
-			Assert.That(user.Counters.Notes.Value, Is.EqualTo(6));
-			Assert.That(user.Counters.Photos.Value, Is.EqualTo(153));
-			Assert.That(user.Counters.Friends.Value, Is.EqualTo(688));
-			Assert.That(user.Counters.OnlineFriends, Is.EqualTo(146));
-			Assert.That(user.Counters.MutualFriends, Is.EqualTo(0));
-			Assert.That(user.Counters.Followers, Is.EqualTo(5934786));
-			Assert.That(user.Counters.Subscriptions, Is.EqualTo(0));
-			Assert.That(user.Counters.Pages, Is.EqualTo(51));
-			Assert.That(user.Universities.Count, Is.EqualTo(1));
-			Assert.That(user.Universities[0].Id, Is.EqualTo(1));
-			Assert.That(user.Universities[0].Country, Is.EqualTo(1));
-			Assert.That(user.Universities[0].City, Is.EqualTo(2));
-			Assert.That(user.Universities[0].Name, Is.EqualTo("СПбГУ"));
-			Assert.That(user.Universities[0].Graduation, Is.EqualTo(2006));
-
-			Assert.That(user.Schools.Count, Is.EqualTo(2));
-			Assert.That(user.Schools[0].Id, Is.EqualTo(1035386));
-			Assert.That(user.Schools[0].Country, Is.EqualTo(88));
-			Assert.That(user.Schools[0].City, Is.EqualTo(16));
-			Assert.That(user.Schools[0].Name, Is.EqualTo("Sc.Elem. Coppino - Falletti di Barolo"));
-			Assert.That(user.Schools[0].YearFrom, Is.EqualTo(1990));
-			Assert.That(user.Schools[0].YearTo, Is.EqualTo(1992));
-			Assert.That(user.Schools[0].Class, Is.EqualTo(string.Empty));
-
-			Assert.That(user.Schools[1].Id, Is.EqualTo(1));
-			Assert.That(user.Schools[1].Country, Is.EqualTo(1));
-			Assert.That(user.Schools[1].City, Is.EqualTo(2));
-			Assert.That(user.Schools[1].Name, Is.EqualTo("Академическая (АГ) СПбГУ"));
-			Assert.That(user.Schools[1].YearFrom, Is.EqualTo(1996));
-			Assert.That(user.Schools[1].YearTo, Is.EqualTo(2001));
-			Assert.That(user.Schools[1].YearGraduated, Is.EqualTo(2001));
-			Assert.That(user.Schools[1].Class, Is.EqualTo("о"));
-			Assert.That(user.Schools[1].Type, Is.EqualTo(1));
-			Assert.That(user.Schools[1].TypeStr, Is.EqualTo("Гимназия"));
-
-			Assert.That(user.Relatives.Count, Is.EqualTo(0));
+			user.CommonCount.Value.Should().Be(0);
+			user.Counters.Albums.Should().Be(1);
+			user.Counters.Videos.Should().Be(8);
+			user.Counters.Audios.Should().Be(0);
+			user.Counters.Notes.Value.Should().Be(6);
+			user.Counters.Photos.Value.Should().Be(153);
+			user.Counters.Friends.Value.Should().Be(688);
+			user.Counters.OnlineFriends.Should().Be(146);
+			user.Counters.MutualFriends.Should().Be(0);
+			user.Counters.Followers.Should().Be(5934786);
+			user.Counters.Subscriptions.Should().Be(0);
+			user.Counters.Pages.Should().Be(51);
+			user.Universities.Count.Should().Be(1);
+			user.Universities[0].Id.Should().Be(1);
+			user.Universities[0].Country.Should().Be(1);
+			user.Universities[0].City.Should().Be(2);
+			user.Universities[0].Name.Should().Be("СПбГУ");
+			user.Universities[0].Graduation.Should().Be(2006);
+
+			user.Schools.Count.Should().Be(2);
+			user.Schools[0].Id.Should().Be(1035386);
+			user.Schools[0].Country.Should().Be(88);
+			user.Schools[0].City.Should().Be(16);
+			user.Schools[0].Name.Should().Be("Sc.Elem. Coppino - Falletti di Barolo");
+			user.Schools[0].YearFrom.Should().Be(1990);
+			user.Schools[0].YearTo.Should().Be(1992);
+			user.Schools[0].Class.Should().BeEmpty();
+
+			user.Schools[1].Id.Should().Be(1);
+			user.Schools[1].Country.Should().Be(1);
+			user.Schools[1].City.Should().Be(2);
+			user.Schools[1].Name.Should().Be("Академическая (АГ) СПбГУ");
+			user.Schools[1].YearFrom.Should().Be(1996);
+			user.Schools[1].YearTo.Should().Be(2001);
+			user.Schools[1].YearGraduated.Should().Be(2001);
+			user.Schools[1].Class.Should().Be("о");
+			user.Schools[1].Type.Should().Be(1);
+			user.Schools[1].TypeStr.Should().Be("Гимназия");
+
+			user.Relatives.Count.Should().Be(0);
 		}

 		[Test]
@@ -277,16 +277,16 @@
 				672
 			});

-			Assert.That(lst.Count, Is.EqualTo(2));
-			Assert.That(lst[0], Is.Not.Null);
-			Assert.That(lst[0].Id, Is.EqualTo(1));
-			Assert.That(lst[0].FirstName, Is.EqualTo("Павел"));
-			Assert.That(lst[0].LastName, Is.EqualTo("Дуров"));
-
-			Assert.That(lst[1], Is.Not.Null);
-			Assert.That(lst[1].Id, Is.EqualTo(672));
-			Assert.That(lst[1].FirstName, Is.EqualTo("Кристина"));
-			Assert.That(lst[1].LastName, Is.EqualTo("Смирнова"));
+			lst.Should().HaveCount(2);
+			lst[0].Should().NotBeNull();
+			lst[0].Id.Should().Be(1);
+			lst[0].FirstName.Should().Be("Павел");
+			lst[0].LastName.Should().Be("Дуров");
+
+			lst[1].Should().NotBeNull();
+			lst[1].Id.Should().Be(672);
+			lst[1].FirstName.Should().Be("Кристина");
+			lst[1].LastName.Should().Be("Смирнова");
 		}

 		[Test]
@@ -297,12 +297,14 @@
 					f.PostAsync(It.IsAny<Uri>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), Encoding.UTF8))
 				.Throws(new VkApiException("The remote name could not be resolved: 'api.vk.com'"));

-			var ex = Assert.Throws<VkApiException>(() => Api.Users.Get(new long[]
-			{
-				1
-			}));
-
-			Assert.That(ex.Message, Is.EqualTo("The remote name could not be resolved: 'api.vk.com'"));
+			FluentActions.Invoking(() => Api.Users.Get(new long[]
+				{
+					1
+				}))
+				.Should()
+				.ThrowExactly<VkApiException>()
+				.And.Message.Should()
+				.Be("The remote name could not be resolved: 'api.vk.com'");
 		}

 		[Test]
@@ -319,87 +321,87 @@
 					NameCase.Gen)
 				.FirstOrDefault();

-			Assert.That(user, Is.Not.Null);
-
-			Assert.That(user.Id, Is.EqualTo(1));
-			Assert.That(user.FirstName, Is.EqualTo("Павла"));
-			Assert.That(user.LastName, Is.EqualTo("Дурова"));
-			Assert.That(user.Sex, Is.EqualTo(Sex.Male));
-			Assert.That(user.Nickname, Is.EqualTo(string.Empty));
-			Assert.That(user.Domain, Is.EqualTo("durov"));
-			Assert.That(user.BirthDate, Is.EqualTo("10.10.1984"));
-			Assert.That(user.City, Is.Not.Null);
-			Assert.That(user.City.Id, Is.EqualTo(2));
-			Assert.That(user.City.Title, Is.EqualTo("Санкт-Петербург"));
-			Assert.That(user.Country, Is.Not.Null);
-			Assert.That(user.Country.Id, Is.EqualTo(1));
-			Assert.That(user.Country.Title, Is.EqualTo("Россия"));
-			Assert.That(user.Timezone, Is.EqualTo(3));
-
-			Assert.That(user.PhotoPreviews.Photo50, Is.EqualTo(new Uri("http://cs7004.vk.me/c7003/v7003079/374b/53lwetwOxD8.jpg")));
-
-			Assert.That(user.PhotoPreviews.Photo100, Is.EqualTo(new Uri("http://cs7004.vk.me/c7003/v7003563/359e/Hei0g6eeaAc.jpg")));
-
-			Assert.That(user.PhotoPreviews.Photo200, Is.EqualTo(new Uri("http://cs7004.vk.me/c7003/v7003237/369a/x4RqtBxY4kc.jpg")));
-
-			Assert.That(user.PhotoPreviews.Photo400, Is.EqualTo(new Uri("http://cs7004.vk.me/c7003/v7003397/3824/JjPJbkvJxpM.jpg")));
-
-			Assert.That(user.PhotoPreviews.PhotoMax, Is.EqualTo(new Uri("http://cs7004.vk.me/c7003/v7003237/369a/x4RqtBxY4kc.jpg")));
-
-			Assert.That(user.HasMobile.HasValue, Is.True);
-			Assert.That(user.HasMobile.Value, Is.True);
-			Assert.That(user.Online.HasValue, Is.True);
-			Assert.That(user.Online.Value, Is.True);
-			Assert.That(user.CanPost, Is.False);
-			Assert.That(user.CanSeeAllPosts, Is.False);
-			Assert.That(user.CanSeeAudio, Is.False);
-			Assert.That(user.CanWritePrivateMessage, Is.False);
-			Assert.That(user.Connections.Twitter, Is.EqualTo("durov"));
-			Assert.That(user.Site, Is.EqualTo(string.Empty));
-			Assert.That(user.Status, Is.EqualTo(string.Empty));
+			user.Should().NotBeNull();
+
+			user.Id.Should().Be(1);
+			user.FirstName.Should().Be("Павла");
+			user.LastName.Should().Be("Дурова");
+			user.Sex.Should().Be(Sex.Male);
+			user.Nickname.Should().BeEmpty();
+			user.Domain.Should().Be("durov");
+			user.BirthDate.Should().Be("10.10.1984");
+			user.City.Should().NotBeNull();
+			user.City.Id.Should().Be(2);
+			user.City.Title.Should().Be("Санкт-Петербург");
+			user.Country.Should().NotBeNull();
+			user.Country.Id.Should().Be(1);
+			user.Country.Title.Should().Be("Россия");
+			user.Timezone.Should().Be(3);
+
+			user.PhotoPreviews.Photo50.Should().Be(new Uri("http://cs7004.vk.me/c7003/v7003079/374b/53lwetwOxD8.jpg"));
+
+			user.PhotoPreviews.Photo100.Should().Be(new Uri("http://cs7004.vk.me/c7003/v7003563/359e/Hei0g6eeaAc.jpg"));
+
+			user.PhotoPreviews.Photo200.Should().Be(new Uri("http://cs7004.vk.me/c7003/v7003237/369a/x4RqtBxY4kc.jpg"));
+
+			user.PhotoPreviews.Photo400.Should().Be(new Uri("http://cs7004.vk.me/c7003/v7003397/3824/JjPJbkvJxpM.jpg"));
+
+			user.PhotoPreviews.PhotoMax.Should().Be(new Uri("http://cs7004.vk.me/c7003/v7003237/369a/x4RqtBxY4kc.jpg"));
+
+			user.HasMobile.Should().HaveValue();
+			user.HasMobile.Should().BeTrue();
+			user.Online.Should().HaveValue();
+			user.Online.Should().BeTrue();
+			user.CanPost.Should().BeFalse();
+			user.CanSeeAllPosts.Should().BeFalse();
+			user.CanSeeAudio.Should().BeFalse();
+			user.CanWritePrivateMessage.Should().BeFalse();
+			user.Connections.Twitter.Should().Be("durov");
+			user.Site.Should().BeEmpty();
+			user.Status.Should().BeEmpty();

 			// TODO: u.LastSeen
-			Assert.That(user.CommonCount.Value, Is.EqualTo(0));
-			Assert.That(user.Counters.Albums, Is.EqualTo(1));
-			Assert.That(user.Counters.Videos, Is.EqualTo(8));
-			Assert.That(user.Counters.Audios, Is.EqualTo(0));
-			Assert.That(user.Counters.Notes.Value, Is.EqualTo(6));
-			Assert.That(user.Counters.Photos.Value, Is.EqualTo(153));
-			Assert.That(user.Counters.Friends.Value, Is.EqualTo(688));
-			Assert.That(user.Counters.OnlineFriends, Is.EqualTo(146));
-			Assert.That(user.Counters.MutualFriends, Is.EqualTo(0));
-			Assert.That(user.Counters.Followers, Is.EqualTo(5934786));
-			Assert.That(user.Counters.Subscriptions, Is.EqualTo(0));
-			Assert.That(user.Counters.Pages, Is.EqualTo(51));
-
-			Assert.That(user.Universities.Count, Is.EqualTo(1));
-			Assert.That(user.Universities[0].Id, Is.EqualTo(1));
-			Assert.That(user.Universities[0].Country, Is.EqualTo(1));
-			Assert.That(user.Universities[0].City, Is.EqualTo(2));
-			Assert.That(user.Universities[0].Name, Is.EqualTo("СПбГУ"));
-			Assert.That(user.Universities[0].Graduation, Is.EqualTo(2006));
-
-			Assert.That(user.Schools.Count, Is.EqualTo(2));
-			Assert.That(user.Schools[0].Id, Is.EqualTo(1035386));
-			Assert.That(user.Schools[0].Country, Is.EqualTo(88));
-			Assert.That(user.Schools[0].City, Is.EqualTo(16));
-			Assert.That(user.Schools[0].Name, Is.EqualTo("Sc.Elem. Coppino - Falletti di Barolo"));
-			Assert.That(user.Schools[0].YearFrom, Is.EqualTo(1990));
-			Assert.That(user.Schools[0].YearTo, Is.EqualTo(1992));
-			Assert.That(user.Schools[0].Class, Is.EqualTo(string.Empty));
-
-			Assert.That(user.Schools[1].Id, Is.EqualTo(1));
-			Assert.That(user.Schools[1].Country, Is.EqualTo(1));
-			Assert.That(user.Schools[1].City, Is.EqualTo(2));
-			Assert.That(user.Schools[1].Name, Is.EqualTo("Академическая (АГ) СПбГУ"));
-			Assert.That(user.Schools[1].YearFrom, Is.EqualTo(1996));
-			Assert.That(user.Schools[1].YearTo, Is.EqualTo(2001));
-			Assert.That(user.Schools[1].YearGraduated, Is.EqualTo(2001));
-			Assert.That(user.Schools[1].Class, Is.EqualTo("о"));
-			Assert.That(user.Schools[1].Type, Is.EqualTo(1));
-			Assert.That(user.Schools[1].TypeStr, Is.EqualTo("Гимназия"));
-
-			Assert.That(user.Relatives.Count, Is.EqualTo(0));
+			user.CommonCount.Value.Should().Be(0);
+			user.Counters.Albums.Should().Be(1);
+			user.Counters.Videos.Should().Be(8);
+			user.Counters.Audios.Should().Be(0);
+			user.Counters.Notes.Value.Should().Be(6);
+			user.Counters.Photos.Value.Should().Be(153);
+			user.Counters.Friends.Value.Should().Be(688);
+			user.Counters.OnlineFriends.Should().Be(146);
+			user.Counters.MutualFriends.Should().Be(0);
+			user.Counters.Followers.Should().Be(5934786);
+			user.Counters.Subscriptions.Should().Be(0);
+			user.Counters.Pages.Should().Be(51);
+
+			user.Universities.Should().HaveCount(1);
+			user.Universities[0].Id.Should().Be(1);
+			user.Universities[0].Country.Should().Be(1);
+			user.Universities[0].City.Should().Be(2);
+			user.Universities[0].Name.Should().Be("СПбГУ");
+			user.Universities[0].Graduation.Should().Be(2006);
+
+			user.Schools.Should().HaveCount(2);
+			user.Schools[0].Id.Should().Be(1035386);
+			user.Schools[0].Country.Should().Be(88);
+			user.Schools[0].City.Should().Be(16);
+			user.Schools[0].Name.Should().Be("Sc.Elem. Coppino - Falletti di Barolo");
+			user.Schools[0].YearFrom.Should().Be(1990);
+			user.Schools[0].YearTo.Should().Be(1992);
+			user.Schools[0].Class.Should().Be(string.Empty);
+
+			user.Schools[1].Id.Should().Be(1);
+			user.Schools[1].Country.Should().Be(1);
+			user.Schools[1].City.Should().Be(2);
+			user.Schools[1].Name.Should().Be("Академическая (АГ) СПбГУ");
+			user.Schools[1].YearFrom.Should().Be(1996);
+			user.Schools[1].YearTo.Should().Be(2001);
+			user.Schools[1].YearGraduated.Should().Be(2001);
+			user.Schools[1].Class.Should().Be("о");
+			user.Schools[1].Type.Should().Be(1);
+			user.Schools[1].TypeStr.Should().Be("Гимназия");
+
+			user.Relatives.Should().BeEmpty();
 		}

 		[Test]
@@ -415,30 +417,30 @@
 				},
 				ProfileFields.Education);

-			Assert.That(lst.Count == 2);
-			Assert.That(lst[0], Is.Not.Null);
-			Assert.That(lst[0].Id, Is.EqualTo(1));
-			Assert.That(lst[0].FirstName, Is.EqualTo("Павел"));
-			Assert.That(lst[0].LastName, Is.EqualTo("Дуров"));
-			Assert.That(lst[0].Education, Is.Not.Null);
-			Assert.That(lst[0].Education.UniversityId, Is.EqualTo(1));
-			Assert.That(lst[0].Education.UniversityName, Is.EqualTo("СПбГУ"));
-			Assert.That(lst[0].Education.FacultyId, Is.Null);
-			Assert.That(lst[0].Education.FacultyName, Is.Null.Or.Empty);
-			Assert.That(lst[0].Education.Graduation, Is.EqualTo(2006));
-
-			Assert.That(lst[1], Is.Not.Null);
-			Assert.That(lst[1].Id, Is.EqualTo(5041431));
-			Assert.That(lst[1].FirstName, Is.EqualTo("Тайфур"));
-			Assert.That(lst[1].LastName, Is.EqualTo("Касеев"));
-			Assert.That(lst[1].Education, Is.Not.Null);
-			Assert.That(lst[1].Education.UniversityId, Is.EqualTo(431));
-			Assert.That(lst[1].Education.UniversityName, Is.EqualTo("ВолгГТУ"));
-			Assert.That(lst[1].Education.FacultyId, Is.EqualTo(3162));
-
-			Assert.That(lst[1].Education.FacultyName, Is.EqualTo("Электроники и вычислительной техники"));
-
-			Assert.That(lst[1].Education.Graduation, Is.EqualTo(2012));
+			lst.Should().HaveCount(2);
+			lst[0].Should().NotBeNull();
+			lst[0].Id.Should().Be(1);
+			lst[0].FirstName.Should().Be("Павел");
+			lst[0].LastName.Should().Be("Дуров");
+			lst[0].Education.Should().NotBeNull();
+			lst[0].Education.UniversityId.Should().Be(1);
+			lst[0].Education.UniversityName.Should().Be("СПбГУ");
+			lst[0].Education.FacultyId.Should().BeNull();
+			lst[0].Education.FacultyName.Should().BeNullOrEmpty();
+			lst[0].Education.Graduation.Should().Be(2006);
+
+			lst[1].Should().NotBeNull();
+			lst[1].Id.Should().Be(5041431);
+			lst[1].FirstName.Should().Be("Тайфур");
+			lst[1].LastName.Should().Be("Касеев");
+			lst[1].Education.Should().NotBeNull();
+			lst[1].Education.UniversityId.Should().Be(431);
+			lst[1].Education.UniversityName.Should().Be("ВолгГТУ");
+			lst[1].Education.FacultyId.Should().Be(3162);
+
+			lst[1].Education.FacultyName.Should().Be("Электроники и вычислительной техники");
+
+			lst[1].Education.Graduation.Should().Be(2012);
 		}

 		[Test]
@@ -458,16 +460,16 @@
 				.FirstOrDefault();

 			// assert
-			Assert.That(user, Is.Not.Null);
-			Assert.That(user.Id, Is.EqualTo(1));
-			Assert.That(user.FirstName, Is.EqualTo("Павел"));
-			Assert.That(user.LastName, Is.EqualTo("Дуров"));
-			Assert.That(user.Education, Is.Not.Null);
-			Assert.That(user.Education.UniversityId, Is.EqualTo(1));
-			Assert.That(user.Education.UniversityName, Is.EqualTo("СПбГУ"));
-			Assert.That(user.Education.FacultyId, Is.Null);
-			Assert.That(user.Education.FacultyName, Is.EqualTo(""));
-			Assert.That(user.Education.Graduation, Is.EqualTo(2006));
+			user.Should().NotBeNull();
+			user.Id.Should().Be(1);
+			user.FirstName.Should().Be("Павел");
+			user.LastName.Should().Be("Дуров");
+			user.Education.Should().NotBeNull();
+			user.Education.UniversityId.Should().Be(1);
+			user.Education.UniversityName.Should().Be("СПбГУ");
+			user.Education.FacultyId.Should().BeNull();
+			user.Education.FacultyName.Should().BeEmpty();
+			user.Education.Graduation.Should().Be(2006);
 		}

 		[Test]
@@ -477,8 +479,11 @@
 			ReadErrorsJsonFile(5);

 			// ReSharper disable once ReturnValueOfPureMethodIsNotUsed
-			var ex = Assert.Throws<UserAuthorizationFailException>(() => Api.Users.Get(new List<long>()));
-			Assert.That(ex.Message, Is.EqualTo("User authorization failed: access_token was given to another ip address."));
+			FluentActions.Invoking(() => Api.Users.Get(new List<long>()))
+				.Should()
+				.ThrowExactly<UserAuthorizationFailException>()
+				.And.Message.Should()
+				.Be("User authorization failed: access_token was given to another ip address.");
 		}

 		[Test]
@@ -489,112 +494,112 @@

 			var users = Api.Users.GetFollowers(1, 2, 3, ProfileFields.All, NameCase.Gen);

-			Assert.That(users, Is.Not.Null);
-			Assert.That(users.Count, Is.EqualTo(2));
+			users.Should().NotBeNull();
+			users.Should().HaveCount(2);

 			var user = users.FirstOrDefault();
-			Assert.That(user, Is.Not.Null);
-
-			Assert.That(user.Id, Is.EqualTo(243663122));
-			Assert.That(user.FirstName, Is.EqualTo("Ивана"));
-			Assert.That(user.LastName, Is.EqualTo("Радюна"));
-			Assert.That(user.Sex, Is.EqualTo(Sex.Male));
-			Assert.That(user.Nickname, Is.EqualTo(string.Empty));
-			Assert.That(user.Domain, Is.EqualTo("id243663122"));
-			Assert.That(user.BirthDate, Is.EqualTo("27.8.1985"));
-			Assert.That(user.City.Id, Is.EqualTo(18632));
-			Assert.That(user.City.Title, Is.EqualTo("Вороново"));
-			Assert.That(user.Country.Id, Is.EqualTo(3));
-			Assert.That(user.Country.Title, Is.EqualTo("Беларусь"));
-			Assert.That(user.Timezone, Is.EqualTo(3));
-
-			Assert.That(user.PhotoPreviews.Photo50, Is.EqualTo(new Uri("http://cs606327.vk.me/v606327122/35ac/R57FNUr34iw.jpg")));
-
-			Assert.That(user.PhotoPreviews.Photo100, Is.EqualTo(new Uri("http://cs606327.vk.me/v606327122/35ab/HUsGNVxBoQU.jpg")));
-
-			Assert.That(user.PhotoPreviews.Photo200, Is.EqualTo(new Uri("http://cs606327.vk.me/v606327122/35aa/4SIM1EWPmes.jpg")));
-
-			Assert.That(user.PhotoPreviews.PhotoMax, Is.EqualTo(new Uri("http://cs606327.vk.me/v606327122/35aa/4SIM1EWPmes.jpg")));
-
-			Assert.That(user.HasMobile, Is.EqualTo(true));
-			Assert.That(user.Online, Is.EqualTo(true));
-			Assert.That(user.OnlineMobile, Is.EqualTo(true));
-			Assert.That(user.CanPost, Is.EqualTo(false));
-			Assert.That(user.CanSeeAllPosts, Is.EqualTo(true));
-			Assert.That(user.CanSeeAudio, Is.EqualTo(true));
-			Assert.That(user.CanWritePrivateMessage, Is.EqualTo(true));
-			Assert.That(user.MobilePhone, Is.EqualTo(string.Empty));
-			Assert.That(user.HomePhone, Is.EqualTo(string.Empty));
-			Assert.That(user.Site, Is.EqualTo(string.Empty));
-
-			Assert.That(user.Status,
-				Is.EqualTo("Пусть ветер гудит в проводах пусть будет осенняя влага пусть люди забудут о нас,но ни забудем друг друга."));
-
-			Assert.That(user.LastSeen.Time, Is.EqualTo(DateHelper.TimeStampToDateTime(1392710539)));
-
-			Assert.That(user.CommonCount, Is.EqualTo(0));
-			Assert.That(user.Universities.Count, Is.EqualTo(0));
-			Assert.That(user.Relation, Is.EqualTo(RelationType.InActiveSearch));
-			Assert.That(user.Schools.Count, Is.EqualTo(0));
-			Assert.That(user.Relatives.Count, Is.EqualTo(0));
+			user.Should().NotBeNull();
+
+			user.Id.Should().Be(243663122);
+			user.FirstName.Should().Be("Ивана");
+			user.LastName.Should().Be("Радюна");
+			user.Sex.Should().Be(Sex.Male);
+			user.Nickname.Should().BeEmpty();
+			user.Domain.Should().Be("id243663122");
+			user.BirthDate.Should().Be("27.8.1985");
+			user.City.Id.Should().Be(18632);
+			user.City.Title.Should().Be("Вороново");
+			user.Country.Id.Should().Be(3);
+			user.Country.Title.Should().Be("Беларусь");
+			user.Timezone.Should().Be(3);
+
+			user.PhotoPreviews.Photo50.Should().Be(new Uri("http://cs606327.vk.me/v606327122/35ac/R57FNUr34iw.jpg"));
+
+			user.PhotoPreviews.Photo100.Should().Be(new Uri("http://cs606327.vk.me/v606327122/35ab/HUsGNVxBoQU.jpg"));
+
+			user.PhotoPreviews.Photo200.Should().Be(new Uri("http://cs606327.vk.me/v606327122/35aa/4SIM1EWPmes.jpg"));
+
+			user.PhotoPreviews.PhotoMax.Should().Be(new Uri("http://cs606327.vk.me/v606327122/35aa/4SIM1EWPmes.jpg"));
+
+			user.HasMobile.Should().BeTrue();
+			user.Online.Should().BeTrue();
+			user.OnlineMobile.Should().BeTrue();
+			user.CanPost.Should().BeFalse();
+			user.CanSeeAllPosts.Should().BeTrue();
+			user.CanSeeAudio.Should().BeTrue();
+			user.CanWritePrivateMessage.Should().BeTrue();
+			user.MobilePhone.Should().BeEmpty();
+			user.HomePhone.Should().BeEmpty();
+			user.Site.Should().BeEmpty();
+
+			user.Status.Should()
+				.Be("Пусть ветер гудит в проводах пусть будет осенняя влага пусть люди забудут о нас,но ни забудем друг друга.");
+
+			user.LastSeen.Time.Should().Be(DateHelper.TimeStampToDateTime(1392710539));
+
+			user.CommonCount.Should().Be(0);
+			user.Universities.Should().BeEmpty();
+			user.Relation.Should().Be(RelationType.InActiveSearch);
+			user.Schools.Should().BeEmpty();
+			user.Relatives.Should().BeEmpty();

 			var user1 = users.Skip(1).FirstOrDefault();
-			Assert.That(user1, Is.Not.Null);
-
-			Assert.That(user1.Id, Is.EqualTo(239897398));
-			Assert.That(user1.FirstName, Is.EqualTo("Софійки"));
-			Assert.That(user1.LastName, Is.EqualTo("Довгалюк"));
-			Assert.That(user1.Sex, Is.EqualTo(Sex.Female));
-			Assert.That(user1.Nickname, Is.EqualTo(string.Empty));
-			Assert.That(user1.Domain, Is.EqualTo("id239897398"));
-			Assert.That(user1.BirthDate, Is.EqualTo("16.6.2000"));
-			Assert.That(user1.City.Id, Is.EqualTo(1559));
-			Assert.That(user1.City.Title, Is.EqualTo("Тернополь"));
-			Assert.That(user1.Country.Id, Is.EqualTo(2));
-			Assert.That(user1.Country.Title, Is.EqualTo("Украина"));
-			Assert.That(user1.Timezone, Is.EqualTo(1));
-
-			Assert.That(user1.PhotoPreviews.Photo50, Is.EqualTo(new Uri("http://cs310121.vk.me/v310121398/8023/LMm-uoyk1-M.jpg")));
-
-			Assert.That(user1.PhotoPreviews.Photo100, Is.EqualTo(new Uri("http://cs310121.vk.me/v310121398/8022/KajnVK0lvFA.jpg")));
-
-			Assert.That(user1.PhotoPreviews.Photo200, Is.EqualTo(new Uri("http://cs310121.vk.me/v310121398/8021/u0l0caRL1lY.jpg")));
-
-			Assert.That(user1.PhotoPreviews.PhotoMax, Is.EqualTo(new Uri("http://cs310121.vk.me/v310121398/8021/u0l0caRL1lY.jpg")));
-
-			Assert.That(user1.HasMobile, Is.EqualTo(true));
-			Assert.That(user1.Online, Is.EqualTo(true));
-			Assert.That(user1.CanPost, Is.EqualTo(false));
-			Assert.That(user1.CanSeeAllPosts, Is.EqualTo(true));
-			Assert.That(user1.CanSeeAudio, Is.EqualTo(true));
-			Assert.That(user1.CanWritePrivateMessage, Is.EqualTo(true));
-			Assert.That(user1.MobilePhone, Is.EqualTo("**********"));
-			Assert.That(user1.HomePhone, Is.EqualTo("*****"));
-			Assert.That(user1.Connections.Skype, Is.EqualTo("немає"));
-			Assert.That(user1.Site, Is.EqualTo(string.Empty));
-
-			Assert.That(user1.Status,
-				Is.EqualTo(
-					"Не варто ображатися на людей за те, що вони не виправдали наших очікувань... ми самі винні, що чекали від них більше, ніж варто було!"));
-
-			Assert.That(user1.LastSeen.Time,
-				Is.EqualTo(new DateTime(2014,
+			user1.Should().NotBeNull();
+
+			user1.Id.Should().Be(239897398);
+			user1.FirstName.Should().Be("Софійки");
+			user1.LastName.Should().Be("Довгалюк");
+			user1.Sex.Should().Be(Sex.Female);
+			user1.Nickname.Should().Be(string.Empty);
+			user1.Domain.Should().Be("id239897398");
+			user1.BirthDate.Should().Be("16.6.2000");
+			user1.City.Id.Should().Be(1559);
+			user1.City.Title.Should().Be("Тернополь");
+			user1.Country.Id.Should().Be(2);
+			user1.Country.Title.Should().Be("Украина");
+			user1.Timezone.Should().Be(1);
+
+			user1.PhotoPreviews.Photo50.Should().Be(new Uri("http://cs310121.vk.me/v310121398/8023/LMm-uoyk1-M.jpg"));
+
+			user1.PhotoPreviews.Photo100.Should().Be(new Uri("http://cs310121.vk.me/v310121398/8022/KajnVK0lvFA.jpg"));
+
+			user1.PhotoPreviews.Photo200.Should().Be(new Uri("http://cs310121.vk.me/v310121398/8021/u0l0caRL1lY.jpg"));
+
+			user1.PhotoPreviews.PhotoMax.Should().Be(new Uri("http://cs310121.vk.me/v310121398/8021/u0l0caRL1lY.jpg"));
+
+			user1.HasMobile.Should().BeTrue();
+			user1.Online.Should().BeTrue();
+			user1.CanPost.Should().BeFalse();
+			user1.CanSeeAllPosts.Should().BeTrue();
+			user1.CanSeeAudio.Should().BeTrue();
+			user1.CanWritePrivateMessage.Should().BeTrue();
+			user1.MobilePhone.Should().Be("**********");
+			user1.HomePhone.Should().Be("*****");
+			user1.Connections.Skype.Should().Be("немає");
+			user1.Site.Should().BeEmpty();
+
+			user1.Status.Should()
+				.Be(
+					"Не варто ображатися на людей за те, що вони не виправдали наших очікувань... ми самі винні, що чекали від них більше, ніж варто було!");
+
+			user1.LastSeen.Time.Should()
+				.Be(new DateTime(2014,
 					2,
 					18,
 					8,
 					1,
 					14,
-					DateTimeKind.Utc)));
-
-			Assert.That(user1.CommonCount, Is.EqualTo(0));
-			Assert.That(user1.Universities.Count, Is.EqualTo(0));
-			Assert.That(user1.Relation, Is.EqualTo(RelationType.Unknown));
-			Assert.That(user1.Schools.Count, Is.EqualTo(0));
-			Assert.That(user1.Relatives.Count, Is.EqualTo(2));
-			Assert.That(user1.Relatives[0].Id, Is.EqualTo(222462523));
-			Assert.That(user1.Relatives[0].Type, Is.EqualTo(RelativeType.Sibling));
-			Assert.That(user1.Relatives[1].Id, Is.EqualTo(207105159));
-			Assert.That(user1.Relatives[1].Type, Is.EqualTo(RelativeType.Sibling));
+					DateTimeKind.Utc));
+
+			user1.CommonCount.Should().Be(0);
+			user1.Universities.Should().BeEmpty();
+			user1.Relation.Should().Be(RelationType.Unknown);
+			user1.Schools.Should().BeEmpty();
+			user1.Relatives.Should().HaveCount(2);
+			user1.Relatives[0].Id.Should().Be(222462523);
+			user1.Relatives[0].Type.Should().Be(RelativeType.Sibling);
+			user1.Relatives[1].Id.Should().Be(207105159);
+			user1.Relatives[1].Type.Should().Be(RelativeType.Sibling);
 		}

 		[Test]
@@ -605,11 +610,11 @@

 			var result = Api.Users.GetFollowers(1, 2, 3);

-			Assert.That(result, Is.Not.Null);
-			Assert.That(result.Count, Is.EqualTo(2));
-
-			Assert.That(result[0].Id, Is.EqualTo(5984118));
-			Assert.That(result[1].Id, Is.EqualTo(179652233));
+			result.Should().NotBeNull();
+			result.Should().HaveCount(2);
+
+			result[0].Id.Should().Be(5984118);
+			result[1].Id.Should().Be(179652233);
 		}

 		[Test]
@@ -620,42 +625,42 @@

 			var result = Api.Users.GetSubscriptions(1, 2, 3);

-			Assert.That(result, Is.Not.Null);
-			Assert.That(result.Count, Is.EqualTo(2));
+			result.Should().NotBeNull();
+			result.Should().HaveCount(2);

 			var group = result.FirstOrDefault();
-			Assert.That(group, Is.Not.Null);
-
-			Assert.That(group.Id, Is.EqualTo(32295218));
-			Assert.That(group.Name, Is.EqualTo("LIVE Экспресс"));
-			Assert.That(group.ScreenName, Is.EqualTo("liveexp"));
-			Assert.That(group.IsClosed, Is.EqualTo(GroupPublicity.Public));
-			Assert.That(group.Type, Is.EqualTo(GroupType.Page));
-			Assert.That(group.IsAdmin, Is.False);
-			Assert.That(group.IsMember, Is.EqualTo(false));
-
-			Assert.That(group.PhotoPreviews.Photo50, Is.EqualTo(new Uri("http://cs412129.vk.me/v412129558/6cea/T3jVq9A5hN4.jpg")));
-
-			Assert.That(group.PhotoPreviews.Photo100, Is.EqualTo(new Uri("http://cs412129.vk.me/v412129558/6ce9/Rs47ldlt4Ko.jpg")));
-
-			Assert.That(group.PhotoPreviews.Photo200, Is.EqualTo(new Uri("http://cs412129.vk.me/v412129604/1238/RhEgZqrsv-w.jpg")));
+			group.Should().NotBeNull();
+
+			group.Id.Should().Be(32295218);
+			group.Name.Should().Be("LIVE Экспресс");
+			group.ScreenName.Should().Be("liveexp");
+			group.IsClosed.Should().Be(GroupPublicity.Public);
+			group.Type.Should().Be(GroupType.Page);
+			group.IsAdmin.Should().BeFalse();
+			group.IsMember.Should().Be(false);
+
+			group.PhotoPreviews.Photo50.Should().Be(new Uri("http://cs412129.vk.me/v412129558/6cea/T3jVq9A5hN4.jpg"));
+
+			group.PhotoPreviews.Photo100.Should().Be(new Uri("http://cs412129.vk.me/v412129558/6ce9/Rs47ldlt4Ko.jpg"));
+
+			group.PhotoPreviews.Photo200.Should().Be(new Uri("http://cs412129.vk.me/v412129604/1238/RhEgZqrsv-w.jpg"));

 			var group1 = result.Skip(1).FirstOrDefault();
-			Assert.That(group1, Is.Not.Null);
-
-			Assert.That(group1.Id, Is.EqualTo(43694972));
-			Assert.That(group1.Name, Is.EqualTo("Sophie Ellis-Bextor"));
-			Assert.That(group1.ScreenName, Is.EqualTo("sophieellisbextor"));
-			Assert.That(group1.IsClosed, Is.EqualTo(GroupPublicity.Public));
-			Assert.That(group1.Type, Is.EqualTo(GroupType.Page));
-			Assert.That(group1.IsAdmin, Is.EqualTo(false));
-			Assert.That(group1.IsMember, Is.EqualTo(false));
-
-			Assert.That(group1.PhotoPreviews.Photo50, Is.EqualTo(new Uri("http://cs417031.vk.me/v417031989/59cb/65zF-xnOQsk.jpg")));
-
-			Assert.That(group1.PhotoPreviews.Photo100, Is.EqualTo(new Uri("http://cs417031.vk.me/v417031989/59ca/eOJ7ER_eJok.jpg")));
-
-			Assert.That(group1.PhotoPreviews.Photo200, Is.EqualTo(new Uri("http://cs417031.vk.me/v417031989/59c8/zI9aAlI-PHc.jpg")));
+			group1.Should().NotBeNull();
+
+			group1.Id.Should().Be(43694972);
+			group1.Name.Should().Be("Sophie Ellis-Bextor");
+			group1.ScreenName.Should().Be("sophieellisbextor");
+			group1.IsClosed.Should().Be(GroupPublicity.Public);
+			group1.Type.Should().Be(GroupType.Page);
+			group1.IsAdmin.Should().Be(false);
+			group1.IsMember.Should().Be(false);
+
+			group1.PhotoPreviews.Photo50.Should().Be(new Uri("http://cs417031.vk.me/v417031989/59cb/65zF-xnOQsk.jpg"));
+
+			group1.PhotoPreviews.Photo100.Should().Be(new Uri("http://cs417031.vk.me/v417031989/59ca/eOJ7ER_eJok.jpg"));
+
+			group1.PhotoPreviews.Photo200.Should().Be(new Uri("http://cs417031.vk.me/v417031989/59c8/zI9aAlI-PHc.jpg"));
 		}

 		// ===================================================================
@@ -667,8 +672,7 @@

 			var result = Api.Users.IsAppUser(1);

-
-			Assert.That(result, Is.False);
+			result.Should().BeFalse();
 		}

 		[Test]
@@ -679,8 +683,7 @@

 			var result = Api.Users.IsAppUser(123);

-
-			Assert.That(result, Is.True);
+			result.Should().BeTrue();
 		}

 		[Test]
@@ -691,8 +694,7 @@

 			var result = Api.Users.Report(243663122, ReportType.Insult, "комментарий");

-
-			Assert.That(result, Is.True);
+			result.Should().BeTrue();
 		}

 		[Test]
@@ -706,9 +708,9 @@
 				Query = "fa'sosjvsoidf"
 			});

-			Assert.That(lst.TotalCount, Is.EqualTo(0));
-			Assert.That(lst, Is.Not.Null);
-			Assert.That(lst.Count, Is.EqualTo(0));
+			lst.TotalCount.Should().Be(0);
+			lst.Should().NotBeNull();
+			lst.Should().BeEmpty();
 		}

 		[Test]
@@ -725,17 +727,17 @@
 				Offset = 123
 			});

-			Assert.That(lst.TotalCount, Is.EqualTo(26953));
-			Assert.That(lst.Count, Is.EqualTo(1));
+			lst.TotalCount.Should().Be(26953);
+			lst.Should().ContainSingle();

 			var maria = lst.FirstOrDefault();
-			Assert.That(maria, Is.Not.Null);
-			Assert.That(maria.Id, Is.EqualTo(165614770));
-			Assert.That(maria.FirstName, Is.EqualTo("Маша"));
-			Assert.That(maria.LastName, Is.EqualTo("Иванова"));
-			Assert.That(maria.Education, Is.Null);
-			Assert.That(maria.Career.Count, Is.EqualTo(1));
-			Assert.That(maria.Career.FirstOrDefault()?.Until, Is.EqualTo(9223372036854777856));
+			maria.Should().NotBeNull();
+			maria.Id.Should().Be(165614770);
+			maria.FirstName.Should().Be("Маша");
+			maria.LastName.Should().Be("Иванова");
+			maria.Education.Should().BeNull();
+			maria.Career.Should().HaveCount(1);
+			(maria.Career.FirstOrDefault()?.Until).Should().Be(9223372036854777856);
 		}

 		[Test]
@@ -749,22 +751,22 @@
 				Query = Query
 			});

-			Assert.That(lst.TotalCount, Is.EqualTo(26953));
-			Assert.That(lst.Count, Is.EqualTo(3));
-			Assert.That(lst[0], Is.Not.Null);
-			Assert.That(lst[0].Id, Is.EqualTo(449928));
-			Assert.That(lst[0].FirstName, Is.EqualTo("Маша"));
-			Assert.That(lst[0].LastName, Is.EqualTo("Иванова"));
-
-			Assert.That(lst[1], Is.Not.Null);
-			Assert.That(lst[1].Id, Is.EqualTo(70145254));
-			Assert.That(lst[1].FirstName, Is.EqualTo("Маша"));
-			Assert.That(lst[1].LastName, Is.EqualTo("Шаблинская-Иванова"));
-
-			Assert.That(lst[2], Is.Not.Null);
-			Assert.That(lst[2].Id, Is.EqualTo(62899425));
-			Assert.That(lst[2].FirstName, Is.EqualTo("Masha"));
-			Assert.That(lst[2].LastName, Is.EqualTo("Ivanova"));
+			lst.TotalCount.Should().Be(26953);
+			lst.Should().HaveCount(3);
+			lst[0].Should().NotBeNull();
+			lst[0].Id.Should().Be(449928);
+			lst[0].FirstName.Should().Be("Маша");
+			lst[0].LastName.Should().Be("Иванова");
+
+			lst[1].Should().NotBeNull();
+			lst[1].Id.Should().Be(70145254);
+			lst[1].FirstName.Should().Be("Маша");
+			lst[1].LastName.Should().Be("Шаблинская-Иванова");
+
+			lst[2].Should().NotBeNull();
+			lst[2].Id.Should().Be(62899425);
+			lst[2].FirstName.Should().Be("Masha");
+			lst[2].LastName.Should().Be("Ivanova");
 		}

 		[Test]
@@ -781,25 +783,25 @@
 				Offset = 123
 			});

-			Assert.That(lst.TotalCount, Is.EqualTo(26953));
-			Assert.That(lst.Count, Is.EqualTo(3));
-			Assert.That(lst[0], Is.Not.Null);
-			Assert.That(lst[0].Id, Is.EqualTo(165614770));
-			Assert.That(lst[0].FirstName, Is.EqualTo("Маша"));
-			Assert.That(lst[0].LastName, Is.EqualTo("Иванова"));
-			Assert.That(lst[0].Education, Is.Null);
-
-			Assert.That(lst[1], Is.Not.Null);
-			Assert.That(lst[1].Id, Is.EqualTo(174063570));
-			Assert.That(lst[1].FirstName, Is.EqualTo("Маша"));
-			Assert.That(lst[1].LastName, Is.EqualTo("Иванова"));
-			Assert.That(lst[1].Education, Is.Null);
-
-			Assert.That(lst[2], Is.Not.Null);
-			Assert.That(lst[2].Id, Is.EqualTo(76817368));
-			Assert.That(lst[2].FirstName, Is.EqualTo("Маша"));
-			Assert.That(lst[2].LastName, Is.EqualTo("Иванова"));
-			Assert.That(lst[2].Education, Is.Null);
+			lst.TotalCount.Should().Be(26953);
+			lst.Should().HaveCount(3);
+			lst[0].Should().NotBeNull();
+			lst[0].Id.Should().Be(165614770);
+			lst[0].FirstName.Should().Be("Маша");
+			lst[0].LastName.Should().Be("Иванова");
+			lst[0].Education.Should().BeNull();
+
+			lst[1].Should().NotBeNull();
+			lst[1].Id.Should().Be(174063570);
+			lst[1].FirstName.Should().Be("Маша");
+			lst[1].LastName.Should().Be("Иванова");
+			lst[1].Education.Should().BeNull();
+
+			lst[2].Should().NotBeNull();
+			lst[2].Id.Should().Be(76817368);
+			lst[2].FirstName.Should().Be("Маша");
+			lst[2].LastName.Should().Be("Иванова");
+			lst[2].Education.Should().BeNull();
 		}
 	}
 }


Added Contract.EndContractBlock

Added Contract.EndContractBlock

Which turns out to be a noop.

--- Core/System/Diagnostics/Contracts/Contract.net35.cs
+++ Core/System/Diagnostics/Contracts/Contract.net35.cs
@@ -1,9 +1,26 @@
 #if NET20 || NET30 || NET35
+
+// ==++==
+//
+//   Copyright (c) Microsoft Corporation.  All rights reserved.
+//
+// ==--==

 namespace System.Diagnostics.Contracts
 {
     public static class Contract
     {
+        /// <summary>
+        /// Marker to indicate the end of the contract section of a method.
+        /// </summary>
+        [Conditional("CONTRACTS_FULL")]
+        #if FEATURE_RELIABILITY_CONTRACTS
+        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+        #endif
+        public static void EndContractBlock()
+        {
+            // Empty
+        }
     }
 }


Fix for batch build

Fix for batch build

--- Core/Theraot/Collections/ThreadSafe/BucketHelper.cs
+++ Core/Theraot/Collections/ThreadSafe/BucketHelper.cs
@@ -1,6 +1,6 @@
 namespace Theraot.Collections.ThreadSafe
 {
-    internal static class BucketHelper
+    internal static partial class BucketHelper
     {
         private static readonly object _null;

@@ -14,15 +14,6 @@
             get
             {
                 return _null;
-            }
-        }
-
-        public static void Recycle<T>(ref FixedSizeSetBucket<T> entries) //Needed
-        {
-            if (!ReferenceEquals(entries, null))
-            {
-                entries.Recycle();
-                entries = null;
             }
         }

@@ -53,4 +44,20 @@
             }
         }
     }
+
+    internal static partial class BucketHelper
+    {
+#if FAT
+
+        public static void Recycle<T>(ref FixedSizeSetBucket<T> entries) //Needed
+        {
+            if (!ReferenceEquals(entries, null))
+            {
+                entries.Recycle();
+                entries = null;
+            }
+        }
+
+#endif
+    }
 }


fix: 修正若 server side 沒有傳回 date header, 則會在 status bar 顯示適當的訊息

--- WebServerClock/Form1.cs
+++ WebServerClock/Form1.cs
@@ -39,13 +39,21 @@
             DateTime t3 = DateTime.Now;
             TimeSpan duration = t3 - t0;

-            DateTime t1p = DateTime.Parse(rsp.Headers.GetValues("Date").First());
-            this.Offset = t1p - t0.AddMilliseconds(duration.TotalMilliseconds / 2);
+            if (rsp.Headers.Date.HasValue)
+            {
+                DateTime t1p = rsp.Headers.Date.Value.DateTime; //DateTime.Parse(rsp.Headers.GetValues("Date").First());
+                this.Offset = t1p - t0.AddMilliseconds(duration.TotalMilliseconds / 2);

-            this.labelOffset.Text = string.Format(
-                @"時間差: {0} msec, 最大誤差值: {1} msec",
-                this.Offset.TotalMilliseconds,
-                duration.TotalMilliseconds / 2);
+                this.labelOffset.Text = string.Format(
+                    @"時間差: {0} msec, 最大誤差值: {1} msec",
+                    this.Offset.TotalMilliseconds,
+                    duration.TotalMilliseconds / 2);
+            }
+            else
+            {
+                this.labelOffset.Text = @"網站沒有傳回 Date header 資料。";
+            }
+
         }
     }
 }


Use common implmentation of bind property

--- RxApp.Android/Bindings.cs
+++ RxApp.Android/Bindings.cs
@@ -20,11 +20,7 @@
     {
         public static IDisposable BindTo<T, TView>(this IObservable<T> This, TView target, Expression<Func<TView, T>> property)
         {
-            var propertySetter = Reflection.GetSetter(property);
-
-            return This.ObserveOnMainThread()
-                       .Subscribe(x =>
-                            propertySetter(target, x));
+            return This.BindTo(target, property, Observable.MainThreadScheduler);
         }

         public static IDisposable Bind(this IRxCommand This, Button button)


背景色のチェック状態をenumで表現した

背景色のチェック状態をenumで表現した

--- WsGH/MainWindow.xaml.cs
+++ WsGH/MainWindow.xaml.cs
@@ -48,27 +48,28 @@
 			 };
 		#endregion
 		// 背景チェック
-		int BackgroundCheck {
-			get { return Properties.Settings.Default.BackgroundColorType; }
+		enum BackgroundType { BlueStacks, Nox, Other };
+		BackgroundType BackgroundCheck {
+			get { return (BackgroundType)Properties.Settings.Default.BackgroundColorType; }
 			set {
-				Properties.Settings.Default.BackgroundColorType = value;
+				Properties.Settings.Default.BackgroundColorType = (int)value;
 				Properties.Settings.Default.Save();
-				switch(Properties.Settings.Default.BackgroundColorType) {
-				case 0:
+				switch(value) {
+				case BackgroundType.BlueStacks:
 					// BlueStacks
 					BackgroundOptionMenuBS.IsChecked = true;
 					BackgroundOptionMenuNox.IsChecked = false;
 					BackgroundOptionMenuOther.IsChecked = false;
 					AddLog($"{Properties.Resources.LoggingTextrBackground} : #000000");
 					break;
-				case 1:
+				case BackgroundType.Nox:
 					// Nox
 					BackgroundOptionMenuBS.IsChecked = false;
 					BackgroundOptionMenuNox.IsChecked = true;
 					BackgroundOptionMenuOther.IsChecked = false;
 					AddLog($"{Properties.Resources.LoggingTextrBackground} : #1C1B20");
 					break;
-				case 2:
+				case BackgroundType.Other:
 					// Other
 					BackgroundOptionMenuBS.IsChecked = false;
 					BackgroundOptionMenuNox.IsChecked = false;
@@ -82,14 +83,17 @@
 		Color BackgroundColor {
 			get {
 				switch(BackgroundCheck) {
-				case 0:
+				case BackgroundType.BlueStacks:
 					// BlueStacks
 					return Color.FromArgb(0, 0, 0);
-				case 1:
+				case BackgroundType.Nox:
 					// Nox
 					return Color.FromArgb(28, 27, 32);
+				case BackgroundType.Other:
+					// Other
+					return Properties.Settings.Default.BackgroundColor;
 				default:
-					// Other
+					// ダミー
 					return Properties.Settings.Default.BackgroundColor;
 				}
 			}
@@ -153,7 +157,7 @@
 				TwitterFlg = Properties.Settings.Default.ScreenshotForTwitterFlg,
 				MenuHeaderBackgroundOther = "",
 			};
-			BackgroundCheck = Properties.Settings.Default.BackgroundColorType;
+			BackgroundCheck = (BackgroundType)Properties.Settings.Default.BackgroundColorType;
 			SoftwareCulture = "";
 			#endregion
 			#region 周辺クラスの初期化
@@ -266,10 +270,10 @@
 			AddLog($"{Properties.Resources.LoggingTextForTwitter} : {(bindData.TwitterFlg ? "True" : "False")}");
 		}
 		private void BackgroundOptionMenuBS_Click(object sender, RoutedEventArgs e) {
-			BackgroundCheck = 0;
+			BackgroundCheck = BackgroundType.BlueStacks;
 		}
 		private void BackgroundOptionMenuNox_Click(object sender, RoutedEventArgs e) {
-			BackgroundCheck = 1;
+			BackgroundCheck = BackgroundType.Nox;
 		}
 		private void BackgroundOptionMenuOther_Click(object sender, RoutedEventArgs e) {
 			// ゲーム背景色を変更するため、色変更ダイアログを表示する
@@ -279,7 +283,7 @@
 				BackgroundColor = cd.Color;
 			}
 			// 画面にも反映させる
-			BackgroundCheck = 2;
+			BackgroundCheck = BackgroundType.Other;
 			var bindData = DataContext as MainWindowDC;
 			bindData.MenuHeaderBackgroundOther = "";
 		}


CA-249845: Compiling the server status reports sometime fails with Sy… (#1542)

* CA-249845: Compiling the server status reports sometime fails with System.IO.IOException: The process cannot access the file because it is being used by another process

Add a retry mechanism around the File.Move, because the operation sometimes fails when there is an anti-virus running on the XenCenter machine (we are doing the move immediately after we finished writing the file and the anti-virus software might be checking the file at that point)

Signed-off-by: Mihaela Stoica <be95049f8e30d921fc7e2579c00c48bd84c40606@citrix.com>

* CA-249845: Compiling the server status reports sometime fails with System.IO.IOException: The process cannot access the file because it is being used by another process

Extract the move with retry into a separate function

Signed-off-by: Mihaela Stoica <be95049f8e30d921fc7e2579c00c48bd84c40606@citrix.com>

--- XenModel/XenAPI/HTTP.cs
+++ XenModel/XenAPI/HTTP.cs
@@ -709,7 +709,7 @@
         /// <summary>
         /// A general HTTP GET method, with delegates for progress and cancelling. May throw various exceptions.
         /// </summary>
-        /// <param name="dataRxDelegate">Delegate called periodically (500 ms) with the number of bytes transferred</param>
+        /// <param name="dataCopiedDelegate">Delegate called periodically (500 ms) with the number of bytes transferred</param>
         /// <param name="cancellingDelegate">Delegate called periodically to see if need to cancel</param>
         /// <param name="uri">URI to GET from</param>
         /// <param name="proxy">A proxy to handle the HTTP connection</param>
@@ -729,12 +729,38 @@
                 }

                 File.Delete(path);
-                File.Move(tmpFile, path);
+                MoveFileWithRetry(tmpFile, path);
             }
             finally
             {
                 File.Delete(tmpFile);
             }
+        }
+
+        private const int FILE_MOVE_MAX_RETRIES = 5;
+        private const int FILE_MOVE_SLEEP_BETWEEN_RETRIES = 100;
+
+        /// <summary>
+        /// Move a file, retrying a few times with a short sleep between retries.
+        /// If it still fails after these retries, then throw the error.
+        /// </summary>
+        public static void MoveFileWithRetry(string sourceFileName, string destFileName)
+        {
+            int retriesRemaining = FILE_MOVE_MAX_RETRIES;
+            do
+            {
+                try
+                {
+                    File.Move(sourceFileName, destFileName);
+                    break;
+                }
+                catch (IOException)
+                {
+                    if (retriesRemaining <= 0)
+                        throw;
+                    System.Threading.Thread.Sleep(FILE_MOVE_SLEEP_BETWEEN_RETRIES);
+                }
+            } while (retriesRemaining-- > 0);
         }
     }
 }


fix warnings in SetterExpressions

fix warnings in SetterExpressions

--- Signum.Engine/Database.cs
+++ Signum.Engine/Database.cs
@@ -1199,15 +1199,8 @@

         public SetterExpressions(LambdaExpression propertyExpression, LambdaExpression valueExpression)
         {
-            if (propertyExpression == null)
-                throw new ArgumentNullException("propertyExpression");
-
-            if (valueExpression == null)
-                throw new ArgumentNullException("valueExpression");
-
-
-            this.PropertyExpression = propertyExpression;
-            this.ValueExpression = valueExpression;
+            this.PropertyExpression = propertyExpression ?? throw new ArgumentNullException("propertyExpression");
+            this.ValueExpression = valueExpression ?? throw new ArgumentNullException("valueExpression");
         }
     }


Replace BinaryFormatter with JsonSerializer due to the former being obsoleted. Tests still fail.

--- SimpSim.NET/StateSaver.cs
+++ SimpSim.NET/StateSaver.cs
@@ -1,5 +1,5 @@
 using System.IO;
-using System.Runtime.Serialization.Formatters.Binary;
+using System.Text.Json;

 namespace SimpSim.NET
 {
@@ -37,14 +37,14 @@

         private void Save(object @object, FileInfo file)
         {
-            using (var fileStream = file.Create())
-                new BinaryFormatter().Serialize(fileStream, @object);
+            using (var streamWriter = file.CreateText())
+                streamWriter.Write(JsonSerializer.Serialize(@object));
         }

         private T Load<T>(FileInfo file)
         {
-            using (var fileStream = file.OpenRead())
-                return (T)new BinaryFormatter().Deserialize(fileStream);
+            using (var streamReader = file.OpenText())
+                return JsonSerializer.Deserialize<T>(streamReader.ReadToEnd());
         }
     }
 }


Fix issue #12: Refactor 'Remove All' button functionality to use 'DataGridView.Rows.Clear' method

--- ZeroMunge/Forms/Main.cs
+++ ZeroMunge/Forms/Main.cs
@@ -1549,8 +1549,10 @@
 		/// <param name="printErrors">Whether or not error messages should be printed to the Output Log.</param>
 		public void ClearFileList(bool printErrors = false)
 		{
+			data_Files.Rows.Clear();
+
 			// Is there at least 1 committed row to remove?
-			if (data_Files.RowCount > 1 && !data_Files.Rows[0].IsNewRow)
+			/*if (data_Files.RowCount > 1 && !data_Files.Rows[0].IsNewRow)
 			{
 				Debug.WriteLine("Rows to remove: " + (data_Files.RowCount - 1));

@@ -1589,7 +1591,7 @@
 					EnableUI(true);
 				});
 				errorThread.Start();
-			}
+			}*/
 		}

 		/// <summary>


Problem with SourceTree Fixed

Problem with SourceTree Fixed

Problem with SourceTree Fixed

--- Player_move.cs
+++ Player_move.cs
@@ -1,23 +1,9 @@
-<<<<<<< HEAD
-using UnityEngine;
+using UnityEngine;
 using System.Collections;

 public class Player_move : MonoBehaviour {

     // Movement keys (now on  Unity Input Manager)
-=======
-using UnityEngine;
-using System.Collections;
-
-public class Player_move : MonoBehaviour {
-
-    // Movement keys (customizable in Inspector)
-    public KeyCode upKey;
-    public KeyCode downKey;
-    public KeyCode rightKey;
-    public KeyCode leftKey;
-    public KeyCode accKey;
->>>>>>> f37553a59a4531b70b1325f3b5190edb226c03db

     // Movement Speed
     public float inicialSpeed = 16;
@@ -44,7 +30,6 @@
     // Use this for initialization
     void Start () {
         //Set Initial Velocity
-<<<<<<< HEAD
         speed = inicialSpeed;
         currentDirection = Vector2.up;
         GetComponent<Rigidbody2D>().velocity = currentDirection * speed;
@@ -52,15 +37,6 @@
         }

     void spawnWall () {
-=======
-        speed = inicialSpeed;
-        currentDirection = Vector2.up;
-        GetComponent<Rigidbody2D>().velocity = currentDirection * speed;
-        spawnWall();
-        }
-
-    void spawnWall () {
->>>>>>> f37553a59a4531b70b1325f3b5190edb226c03db
         // Save last wall's position
         lastWallEnd = transform.position;
         // Spawn a new Lightwall
@@ -81,8 +57,8 @@
         }

     // Update is called once per frame
-    void Update () {
-        //Input
+    void Update () {
+        //Input
         Vector2 inputDirection = new Vector2(Input.GetAxisRaw("Horizontal"),Input.GetAxisRaw("Vertical")).normalized;

@@ -90,15 +66,9 @@
         print(GetComponent<Rigidbody2D>().velocity);

         //Speed up
-<<<<<<< HEAD
-        if (Input.GetAxis("Fire1")>0)
+        if (Input.GetAxis("Fire1") > 0)
             GetComponent<Rigidbody2D>().velocity += (currentDirection * acelerationRate);

-=======
-        if (Input.GetKey(accKey))
-            GetComponent<Rigidbody2D>().velocity += (currentDirection * acelerationRate);
-
->>>>>>> f37553a59a4531b70b1325f3b5190edb226c03db

         // Check for key presses
         if (inputDirection.y == 1 && currentDirection.y == 0) {
@@ -127,19 +97,9 @@

     void OnTriggerEnter2D (Collider2D co) {
         // Not the current wall?
-<<<<<<< HEAD
         if (co != wall) {
             print("Player lost:" + name);
             Destroy(gameObject);
             }
         }
     }
-
-=======
-        if (co != wall) {
-            print("Player lost:" + name);
-            Destroy(gameObject);
-            }
-        }
-    }
->>>>>>> f37553a59a4531b70b1325f3b5190edb226c03db


added complete with ddl menu option

added complete with ddl menu option

--- EADatabaseTransformer/EADatabaseTransformerAddin.cs
+++ EADatabaseTransformer/EADatabaseTransformerAddin.cs
@@ -1,6 +1,7 @@

 using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using System.Windows.Forms;
 using EAAddinFramework.Databases.Transformation.DB2;
@@ -22,7 +23,9 @@
         const string menuComparetoDatabase = "&Compare Database";
         const string menuSettings = "&Settings";
         const string menuAbout = "&About";
+        const string menuCompleteDBwithDLL = "&Complete database with DLL";
         const string compareControlName = "Database Compare";
+

         //private attributes
         private UTF_EA.Model model = null;
@@ -37,7 +40,7 @@
 		public EADatabaseTransformerAddin():base()
 		{
 			this.menuHeader = menuName;
-			this.menuOptions = new string[]{menuComparetoDatabase, menuSettings, menuAbout};
+			this.menuOptions = new string[]{menuComparetoDatabase,menuCompleteDBwithDLL, menuSettings, menuAbout};
 			this.settings = new EADatabaseTransformerSettings();
 		}
 		private DBCompareControl dbCompareControl
@@ -149,6 +152,17 @@
             			IsEnabled = false;
             		}
             		break;
+            	case menuCompleteDBwithDLL:
+            		if (this.fullyLoaded)
+	            	{
+            			var selectedPackage = this.model.selectedElement as UML.Classes.Kernel.Package;
+            			IsEnabled = (selectedPackage != null && selectedPackage.stereotypes.Any(x => x.name.Equals("database",StringComparison.InvariantCultureIgnoreCase)));
+	            	}
+            		else
+            		{
+            			IsEnabled = false;
+            		}
+            		break;
             	case menuAbout:
             		IsEnabled = true;
             		break;
@@ -178,6 +192,9 @@
                 	this.compareDatabase();
                 	Repository.ActivateTab(compareControlName);
                     break;
+                   case menuCompleteDBwithDLL:
+                    this.completeDBwithDLL();
+                    break;
 		        case menuAbout :
 		            new AboutWindow().ShowDialog();
 		            break;
@@ -186,6 +203,33 @@
 	                break;
             }
         }
+		/// <summary>
+		/// gets the current database and completes it with the user selected ddl file
+		/// </summary>
+		void completeDBwithDLL()
+		{
+			//initialize database
+			var selectedPackage = this.model.selectedElement as UTF_EA.Package;
+			var selectedDatabase = DB2DatabaseTransformer.getFactory(this.model).createDataBase(selectedPackage);
+			//get user selected DDL file
+            OpenFileDialog browseDDLFileDialog = new OpenFileDialog();
+            browseDDLFileDialog.Filter = "DDL File |*.sql;*.txt";
+            browseDDLFileDialog.FilterIndex = 1;
+            browseDDLFileDialog.Multiselect = false;
+            var dialogResult = browseDDLFileDialog.ShowDialog();
+            if (dialogResult == DialogResult.OK)
+            {
+            	//if the user selected the file then put the filename in the abbreviationsfileTextBox
+                var ddlFileName = browseDDLFileDialog.FileName;
+                //read the file contents
+                //workaround to make sure it also works when the file is open
+				var fileStream = new FileStream(ddlFileName,FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
+				var reader = new StreamReader(fileStream);
+				string ddl = reader.ReadToEnd();
+				selectedDatabase.complete(ddl);
+            }
+		}
+
   		/// <summary>
   		/// start the transformation from the logical model to the database model
   		/// </summary>


[Engine] Fixed bug where debug text objects would sometimes not render properly.


Fixed minor bug in Grammar Explorer

Fixed minor bug in Grammar Explorer

--- Irony.GrammarExplorer/fmGrammarExplorer.Designer.cs
+++ Irony.GrammarExplorer/fmGrammarExplorer.Designer.cs
@@ -333,6 +333,7 @@
       this.txtSource.Size = new System.Drawing.Size(729, 466);
       this.txtSource.TabIndex = 22;
       this.txtSource.Text = "";
+      this.txtSource.TextChanged += new System.EventHandler(this.txtSource_TextChanged);
       //
       // splitter4
       //


Comments.

Comments.

--- RemoteFunc.cs
+++ RemoteFunc.cs
@@ -2,10 +2,28 @@
 {
     using System;

+    /// <summary>
+    /// Static class for executing functions in foreign application domains.
+    /// </summary>
     public static class RemoteFunc
     {
         #region Public Methods

+        /// <summary>
+        /// Invokes the target function.
+        /// </summary>
+        /// <typeparam name="TResult">
+        /// The result type.
+        /// </typeparam>
+        /// <param name="domain">
+        /// The domain to invoke the function in.
+        /// </param>
+        /// <param name="toInvoke">
+        /// The function to invoke.
+        /// </param>
+        /// <returns>
+        /// The result.
+        /// </returns>
         public static TResult Invoke<TResult>(AppDomain domain, Func<TResult> toInvoke)
         {
             if (domain == null)
@@ -22,6 +40,27 @@
             return proxy.RemoteObject.Invoke(toInvoke);
         }

+        /// <summary>
+        /// Invokes the target function.
+        /// </summary>
+        /// <typeparam name="T1">
+        /// First argument type.
+        /// </typeparam>
+        /// <typeparam name="TResult">
+        /// The result type.
+        /// </typeparam>
+        /// <param name="domain">
+        /// The domain to invoke the function in.
+        /// </param>
+        /// <param name="arg1">
+        /// The first argument.
+        /// </param>
+        /// <param name="toInvoke">
+        /// The function to invoke.
+        /// </param>
+        /// <returns>
+        /// The result.
+        /// </returns>
         public static TResult Invoke<T, TResult>(AppDomain domain, T arg1, Func<T, TResult> toInvoke)
         {
             if (domain == null)
@@ -38,6 +77,33 @@
             return proxy.RemoteObject.Invoke(arg1, toInvoke);
         }

+        /// <summary>
+        /// Invokes the target function.
+        /// </summary>
+        /// <typeparam name="T1">
+        /// First argument type.
+        /// </typeparam>
+        /// <typeparam name="T2">
+        /// Second argument type.
+        /// </typeparam>
+        /// <typeparam name="TResult">
+        /// The result type.
+        /// </typeparam>
+        /// <param name="domain">
+        /// The domain to invoke the function in.
+        /// </param>
+        /// <param name="arg1">
+        /// The first argument.
+        /// </param>
+        /// <param name="arg2">
+        /// The second argument.
+        /// </param>
+        /// <param name="toInvoke">
+        /// The function to invoke.
+        /// </param>
+        /// <returns>
+        /// The result.
+        /// </returns>
         public static TResult Invoke<T1, T2, TResult>(AppDomain domain, T1 arg1, T2 arg2, Func<T1, T2, TResult> toInvoke)
         {
             if (domain == null)
@@ -54,6 +120,39 @@
             return proxy.RemoteObject.Invoke(arg1, arg2, toInvoke);
         }

+        /// <summary>
+        /// Invokes the target function.
+        /// </summary>
+        /// <typeparam name="T1">
+        /// First argument type.
+        /// </typeparam>
+        /// <typeparam name="T2">
+        /// Second argument type.
+        /// </typeparam>
+        /// <typeparam name="T3">
+        /// Third argument type.
+        /// </typeparam>
+        /// <typeparam name="TResult">
+        /// The result type.
+        /// </typeparam>
+        /// <param name="domain">
+        /// The domain to invoke the function in.
+        /// </param>
+        /// <param name="arg1">
+        /// The first argument.
+        /// </param>
+        /// <param name="arg2">
+        /// The second argument.
+        /// </param>
+        /// <param name="arg3">
+        /// The third argument.
+        /// </param>
+        /// <param name="toInvoke">
+        /// The function to invoke.
+        /// </param>
+        /// <returns>
+        /// The result.
+        /// </returns>
         public static TResult Invoke<T1, T2, T3, TResult>(AppDomain domain, T1 arg1, T2 arg2, T3 arg3, Func<T1, T2, T3, TResult> toInvoke)
         {
             if (domain == null)
@@ -70,6 +169,45 @@
             return proxy.RemoteObject.Invoke(arg1, arg2, arg3, toInvoke);
         }

+        /// <summary>
+        /// Invokes the target function.
+        /// </summary>
+        /// <typeparam name="T1">
+        /// First argument type.
+        /// </typeparam>
+        /// <typeparam name="T2">
+        /// Second argument type.
+        /// </typeparam>
+        /// <typeparam name="T3">
+        /// Third argument type.
+        /// </typeparam>
+        /// <typeparam name="T4">
+        /// Fourth argument type.
+        /// </typeparam>
+        /// <typeparam name="TResult">
+        /// The result type.
+        /// </typeparam>
+        /// <param name="domain">
+        /// The domain to invoke the function in.
+        /// </param>
+        /// <param name="arg1">
+        /// The first argument.
+        /// </param>
+        /// <param name="arg2">
+        /// The second argument.
+        /// </param>
+        /// <param name="arg3">
+        /// The third argument.
+        /// </param>
+        /// <param name="arg4">
+        /// The fourth argument.
+        /// </param>
+        /// <param name="toInvoke">
+        /// The function to invoke.
+        /// </param>
+        /// <returns>
+        /// The result.
+        /// </returns>
         public static TResult Invoke<T1, T2, T3, T4, TResult>(AppDomain domain, T1 arg1, T2 arg2, T3 arg3, T4 arg4, Func<T1, T2, T3, T4, TResult> toInvoke)
         {
             if (domain == null)
@@ -89,10 +227,19 @@
         #endregion
     }

+    /// <summary>
+    /// Executes a function in another application domain.
+    /// </summary>
+    /// <typeparam name="TResult">
+    /// The result type.
+    /// </typeparam>
     public class RemoteFunc<TResult> : MarshalByRefObject
     {
         #region Constructors & Destructors

+        /// <summary>
+        /// Initializes a new instance of the RemoteFunc class.
+        /// </summary>
         public RemoteFunc()
         {
         }
@@ -101,6 +248,15 @@

         #region Public Methods

+        /// <summary>
+        /// Invokes the target function.
+        /// </summary>
+        /// <param name="toInvoke">
+        /// The function to invoke.
+        /// </param>
+        /// <returns>
+        /// The result.
+        /// </returns>
         public TResult Invoke(Func<TResult> toInvoke)
         {
             if (toInvoke == null)
@@ -114,10 +270,22 @@
         #endregion
     }

+    /// <summary>
+    /// Executes a function in another application domain.
+    /// </summary>
+    /// <typeparam name="T">
+    /// First argument type.
+    /// </typeparam>
+    /// <typeparam name="TResult">
+    /// The result type.
+    /// </typeparam>
     public class RemoteFunc<T, TResult> : MarshalByRefObject
     {
         #region Constructors & Destructors

+        /// <summary>
+        /// Initializes a new instance of the RemoteFunc class.
+        /// </summary>
         public RemoteFunc()
         {
         }
@@ -126,7 +294,19 @@

         #region Public Methods

-        public  TResult Invoke(T arg, Func<T, TResult> toInvoke)
+        /// <summary>
+        /// Invokes the target function.
+        /// </summary>
+        /// <param name="arg1">
+        /// The first argument.
+        /// </param>
+        /// <param name="toInvoke">
+        /// The function to invoke.
+        /// </param>
+        /// <returns>
+        /// The result.
+        /// </returns>
+        public TResult Invoke(T arg, Func<T, TResult> toInvoke)
         {
             if (toInvoke == null)
             {
@@ -139,10 +319,25 @@
         #endregion
     }

+    /// <summary>
+    /// Executes a function in another application domain.
+    /// </summary>
+    /// <typeparam name="T1">
+    /// First argument type.
+    /// </typeparam>
+    /// <typeparam name="T2">
+    /// Second argument type.
+    /// </typeparam>
+    /// <typeparam name="TResult">
+    /// The result type.
+    /// </typeparam>
     public class RemoteFunc<T1, T2, TResult> : MarshalByRefObject
     {
         #region Constructors & Destructors

+        /// <summary>
+        /// Initializes a new instance of the RemoteFunc class.
+        /// </summary>
         public RemoteFunc()
         {
         }
@@ -151,6 +346,21 @@

         #region Public Methods

+        /// <summary>
+        /// Invokes the target function.
+        /// </summary>
+        /// <param name="arg1">
+        /// The first argument.
+        /// </param>
+        /// <param name="arg2">
+        /// The second argument.
+        /// </param>
+        /// <param name="toInvoke">
+        /// The function to invoke.
+        /// </param>
+        /// <returns>
+        /// The result.
+        /// </returns>
         public TResult Invoke(T1 arg1, T2 arg2, Func<T1, T2, TResult> toInvoke)
         {
             if (toInvoke == null)
@@ -164,10 +374,28 @@
         #endregion
     }

+    /// <summary>
+    /// Executes a function in another application domain.
+    /// </summary>
+    /// <typeparam name="T1">
+    /// First argument type.
+    /// </typeparam>
+    /// <typeparam name="T2">
+    /// Second argument type.
+    /// </typeparam>
+    /// <typeparam name="T3">
+    /// Third argument type.
+    /// </typeparam>
+    /// <typeparam name="TResult">
+    /// The result type.
+    /// </typeparam>
     public class RemoteFunc<T1, T2, T3, TResult> : MarshalByRefObject
     {
         #region Constructors & Destructors

+        /// <summary>
+        /// Initializes a new instance of the RemoteFunc class.
+        /// </summary>
         public RemoteFunc()
         {
         }
@@ -176,6 +404,24 @@

         #region Public Methods

+        /// <summary>
+        /// Invokes the target function.
+        /// </summary>
+        /// <param name="arg1">
+        /// The first argument.
+        /// </param>
+        /// <param name="arg2">
+        /// The second argument.
+        /// </param>
+        /// <param name="arg3">
+        /// The third argument.
+        /// </param>
+        /// <param name="toInvoke">
+        /// The function to invoke.
+        /// </param>
+        /// <returns>
+        /// The result.
+        /// </returns>
         public TResult Invoke(T1 arg1, T2 arg2, T3 arg3, Func<T1, T2, T3, TResult> toInvoke)
         {
             if (toInvoke == null)
@@ -189,10 +435,31 @@
         #endregion
     }

-    public class RemoteFunc <T1, T2, T3, T4, TResult> : MarshalByRefObject
+    /// <summary>
+    /// Executes a function in another application domain.
+    /// </summary>
+    /// <typeparam name="T1">
+    /// First argument type.
+    /// </typeparam>
+    /// <typeparam name="T2">
+    /// Second argument type.
+    /// </typeparam>
+    /// <typeparam name="T3">
+    /// Third argument type.
+    /// </typeparam>
+    /// <typeparam name="T4">
+    /// Fourth argument type.
+    /// </typeparam>
+    /// <typeparam name="TResult">
+    /// The result type.
+    /// </typeparam>
+    public class RemoteFunc<T1, T2, T3, T4, TResult> : MarshalByRefObject
     {
         #region Constructors & Destructors

+        /// <summary>
+        /// Initializes a new instance of the RemoteFunc class.
+        /// </summary>
         public RemoteFunc()
         {
         }
@@ -201,6 +468,27 @@

         #region Public Methods

+        /// <summary>
+        /// Invokes the target function.
+        /// </summary>
+        /// <param name="arg1">
+        /// The first argument.
+        /// </param>
+        /// <param name="arg2">
+        /// The second argument.
+        /// </param>
+        /// <param name="arg3">
+        /// The third argument.
+        /// </param>
+        /// <param name="arg4">
+        /// The fourth argument.
+        /// </param>
+        /// <param name="toInvoke">
+        /// The function to invoke.
+        /// </param>
+        /// <returns>
+        /// The result.
+        /// </returns>
         public TResult Invoke(T1 arg1, T2 arg2, T3 arg3, T4 arg4, Func<T1, T2, T3, T4, TResult> toInvoke)
         {
             if (toInvoke == null)