Add locks for saving and cloning

Add locks for saving and cloning

When cloning documents in multithreaded scenarios this typically lead to
exceptions thrown by the underlying System.IO.Packaging code. This commit,
therefore, adds locks to the Save() and Clone() methods to prevent those
exceptions from being thrown.

--- DocumentFormat.OpenXml/src/Framework/OpenXmlPackage.cs
+++ DocumentFormat.OpenXml/src/Framework/OpenXmlPackage.cs
@@ -1532,6 +1532,8 @@

         #region saving

+        private readonly object _saveAndCloneLock = new object();
+
         /// <summary>
         /// Saves the contents of all parts and relationships that are contained
         /// in the OpenXml package, if FileOpenAccess is ReadWrite.
@@ -1541,8 +1543,12 @@
             ThrowIfObjectDisposed();
             if (FileOpenAccess == FileAccess.ReadWrite)
             {
-                SavePartContents();
-                Package.Flush();
+                lock (_saveAndCloneLock)
+                {
+                    SavePartContents();
+                    // TODO: Revisit.
+                    // Package.Flush();
+                }
             }
         }

@@ -1626,28 +1632,31 @@
             if (openSettings == null)
                 openSettings = OpenSettings;

-            // Save the contents of all parts and relationships that are contained
-            // in the OpenXml package to make sure we clone a consistent state.
-            // This will also invoke ThrowIfObjectDisposed(), so we don't need
-            // to call it here.
-            Save();
-
-            // Create new OpenXmlPackage backed by stream. Next, copy all document
-            // parts (AddPart will copy the parts and their children in a recursive
-            // fashion) and close/dispose the document (by leaving the scope of the
-            // using statement). Finally, reopen the clone from the MemoryStream.
-            // This way, writing the stream to a file, for example, directly after
-            // returning from this method will not lead to issues with corrupt files
-            // and a FileFormatException ("Compressed part has inconsistent data length")
-            // thrown within OpenXmlPackage.OpenCore(string, bool) by the
-            //     this._metroPackage = Package.Open(path, ...);
-            // assignment.
-            using (OpenXmlPackage clone = CreateClone(stream))
-            {
-                foreach (var part in this.Parts)
-                    clone.AddPart(part.OpenXmlPart, part.RelationshipId);
-            }
-            return OpenClone(stream, isEditable, openSettings);
+            lock (_saveAndCloneLock)
+            {
+                // Save the contents of all parts and relationships that are contained
+                // in the OpenXml package to make sure we clone a consistent state.
+                // This will also invoke ThrowIfObjectDisposed(), so we don't need
+                // to call it here.
+                Save();
+
+                // Create new OpenXmlPackage backed by stream. Next, copy all document
+                // parts (AddPart will copy the parts and their children in a recursive
+                // fashion) and close/dispose the document (by leaving the scope of the
+                // using statement). Finally, reopen the clone from the MemoryStream.
+                // This way, writing the stream to a file, for example, directly after
+                // returning from this method will not lead to issues with corrupt files
+                // and a FileFormatException ("Compressed part has inconsistent data length")
+                // thrown within OpenXmlPackage.OpenCore(string, bool) by the
+                //     this._metroPackage = Package.Open(path, ...);
+                // assignment.
+                using (OpenXmlPackage clone = CreateClone(stream))
+                {
+                    foreach (var part in this.Parts)
+                        clone.AddPart(part.OpenXmlPart, part.RelationshipId);
+                }
+                return OpenClone(stream, isEditable, openSettings);
+            }
         }

         /// <summary>
@@ -1718,20 +1727,23 @@
             if (openSettings == null)
                 openSettings = OpenSettings;

-            // Save the contents of all parts and relationships that are contained
-            // in the OpenXml package to make sure we clone a consistent state.
-            // This will also invoke ThrowIfObjectDisposed(), so we don't need
-            // to call it here.
-            Save();
-
-            // Use the same approach as for the streams-based cloning, i.e., close
-            // and reopen the document.
-            using (OpenXmlPackage clone = CreateClone(path))
-            {
-                foreach (var part in this.Parts)
-                    clone.AddPart(part.OpenXmlPart, part.RelationshipId);
-            }
-            return OpenClone(path, isEditable, openSettings);
+            lock (_saveAndCloneLock)
+            {
+                // Save the contents of all parts and relationships that are contained
+                // in the OpenXml package to make sure we clone a consistent state.
+                // This will also invoke ThrowIfObjectDisposed(), so we don't need
+                // to call it here.
+                Save();
+
+                // Use the same approach as for the streams-based cloning, i.e., close
+                // and reopen the document.
+                using (OpenXmlPackage clone = CreateClone(path))
+                {
+                    foreach (var part in this.Parts)
+                        clone.AddPart(part.OpenXmlPart, part.RelationshipId);
+                }
+                return OpenClone(path, isEditable, openSettings);
+            }
         }

         /// <summary>
@@ -1786,32 +1798,36 @@
             if (openSettings == null)
                 openSettings = OpenSettings;

-            // Save the contents of all parts and relationships that are contained
-            // in the OpenXml package to make sure we clone a consistent state.
-            // This will also invoke ThrowIfObjectDisposed(), so we don't need
-            // to call it here.
-            Save();
-
-            // Create a new OpenXml package, copy this package's parts, and flush.
-            // This is different from the stream and file-based cloning, because
-            // we don't close the package here (whereas it will be closed in
-            // stream and file-based cloning to make sure the underlying stream
-            // or file can be read without any corruption issues directly after
-            // having cloned the OpenXml package).
-            OpenXmlPackage clone = CreateClone(package);
-            foreach (var part in this.Parts)
-            {
-                clone.AddPart(part.OpenXmlPart, part.RelationshipId);
-            }
-            package.Flush();
-
-            // Configure OpenSettings.
-            clone.OpenSettings.AutoSave = openSettings.AutoSave;
-            clone.OpenSettings.MarkupCompatibilityProcessSettings.ProcessMode = openSettings.MarkupCompatibilityProcessSettings.ProcessMode;
-            clone.OpenSettings.MarkupCompatibilityProcessSettings.TargetFileFormatVersions = openSettings.MarkupCompatibilityProcessSettings.TargetFileFormatVersions;
-            clone.MaxCharactersInPart = openSettings.MaxCharactersInPart;
-
-            return clone;
+            lock (_saveAndCloneLock)
+            {
+                // Save the contents of all parts and relationships that are contained
+                // in the OpenXml package to make sure we clone a consistent state.
+                // This will also invoke ThrowIfObjectDisposed(), so we don't need
+                // to call it here.
+                Save();
+
+                // Create a new OpenXml package, copy this package's parts, and flush.
+                // This is different from the stream and file-based cloning, because
+                // we don't close the package here (whereas it will be closed in
+                // stream and file-based cloning to make sure the underlying stream
+                // or file can be read without any corruption issues directly after
+                // having cloned the OpenXml package).
+                OpenXmlPackage clone = CreateClone(package);
+                foreach (var part in this.Parts)
+                {
+                    clone.AddPart(part.OpenXmlPart, part.RelationshipId);
+                }
+                // TODO: Revisit.
+                // package.Flush();
+
+                // Configure OpenSettings.
+                clone.OpenSettings.AutoSave = openSettings.AutoSave;
+                clone.OpenSettings.MarkupCompatibilityProcessSettings.ProcessMode = openSettings.MarkupCompatibilityProcessSettings.ProcessMode;
+                clone.OpenSettings.MarkupCompatibilityProcessSettings.TargetFileFormatVersions = openSettings.MarkupCompatibilityProcessSettings.TargetFileFormatVersions;
+                clone.MaxCharactersInPart = openSettings.MaxCharactersInPart;
+
+                return clone;
+            }
         }

         /// <summary>


ITabsterPlugin refactoring and documentation.

--- Plugins/ITabsterPlugin.cs
+++ Plugins/ITabsterPlugin.cs
@@ -1,13 +1,46 @@
-using System;
+#region
+
+using System;
+
+#endregion

 namespace Tabster.Core.Plugins
 {
     public interface ITabsterPlugin
     {
-        string Name { get; }
+        /// <summary>
+        /// Plugin author.
+        /// </summary>
+        string Author { get; }
+
+        /// <summary>
+        /// Plugin copyright.
+        /// </summary>
+        string Copyright { get; }
+
+        /// <summary>
+        /// Plugin description.
+        /// </summary>
         string Description { get; }
-        string Author { get; }
-        string Version { get; }
+
+        /// <summary>
+        /// Plugin display name.
+        /// </summary>
+        string DisplayName { get; }
+
+        /// <summary>
+        /// Plugin version.
+        /// </summary>
+        Version Version { get; }
+
+        /// <summary>
+        /// Plguin website.
+        /// </summary>
+        Uri Website { get; }
+
+        /// <summary>
+        /// Publically exposed plugin types.
+        /// </summary>
         Type[] Types { get; }
     }
-}
+}


Re-added complete interactive mode

Re-added complete interactive mode

--- Pluton.Patcher/Program.cs
+++ Pluton.Patcher/Program.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.IO;
 using Mono.Cecil;
 using Mono.Cecil.Cil;
@@ -519,12 +519,15 @@
          * 10 : File not found
          * 20 : Reading dll error
          * 30 : Server already patched
-         * 40 : Generic patch exeption
+         * 40 : Generic patch exeption Assembly-CSharp
+         * 41 : Generic patch exeption Facepunch
          * 50 : File write error
          */
         public static int Main(string[] args)
         {
-            bool interactive = false;
+            bool interactive = true;
+            if (args.Length > 0)
+                interactive = false;

             Console.WriteLine(string.Format("[( Pluton Patcher v{0} )]", version));
             try {
@@ -577,6 +580,12 @@
                     Console.WriteLine();
                     Console.WriteLine(ex.StackTrace.ToString());
                     Console.WriteLine();
+
+                    if (interactive) {
+                        Console.WriteLine("Press any key to continue...");
+                        Console.ReadKey();
+                    }
+                    return 40;
                 }
             }
             else
@@ -598,10 +607,15 @@
                     Console.WriteLine();
                     Console.WriteLine(ex.Message.ToString());

-                    //Normal handle for the others
                     Console.WriteLine();
                     Console.WriteLine(ex.StackTrace.ToString());
                     Console.WriteLine();
+
+                    if (interactive) {
+                        Console.WriteLine("Press any key to continue...");
+                        Console.ReadKey();
+                    }
+                    return 41;
                 }
             }
             else
@@ -626,10 +640,6 @@

             //Successfully patched the server
             Console.WriteLine("Completed !");
-            if (interactive) {
-                Console.WriteLine("Press any key to continue...");
-                Console.ReadKey();
-            }

             Environment.Exit(0);
             return -1;


Removed root as special case from ImmutableHierachy.Remove

--- Elementary.Hierarchy.Collections/ImmutableHierarchy.cs
+++ Elementary.Hierarchy.Collections/ImmutableHierarchy.cs
@@ -289,14 +289,10 @@
         /// <returns>true if value was removed</returns>
         public ImmutableHierarchy<TKey, TValue> Remove(HierarchyPath<TKey> hierarchyPath)
         {
-            // if the path has no items, the root node is changed
-            if (!hierarchyPath.Items.Any())
-                return this.CreateIfRootHasChanged(this.rootNode.UnsetValue(prune: this.pruneOnUnsetValue));
-
-            // now find the the value node and the path to reach it
-
             Stack<Node> nodesAlongPath = new Stack<Node>();
             Node currentNode;
+
+            // try to get the node to remove values from

             if (!this.TryGetNode(hierarchyPath, out nodesAlongPath, out currentNode))
                 throw new KeyNotFoundException($"Could not find node '{hierarchyPath}'");


Fixed ZKillboard header parse bug

Fixed ZKillboard header parse bug

--- EveLib.ZKillboard/RequestHandlers/ZkbRequestHandler.cs
+++ EveLib.ZKillboard/RequestHandlers/ZkbRequestHandler.cs
@@ -72,7 +72,7 @@
             using (
                 HttpWebResponse response = await HttpRequestHelper.GetResponseAsync(request).ConfigureAwait(false)) {
                 data = await HttpRequestHelper.GetResponseContentAsync(response).ConfigureAwait(false);
-                cacheTime = DateTime.Parse(response.GetResponseHeader("Expires"));
+                DateTime.TryParse(response.GetResponseHeader("Expires"), out cacheTime);
                 int.TryParse(response.GetResponseHeader("X-Bin-Request-Count"), out requestCount);
                 int.TryParse(response.GetResponseHeader("X-Bin-Max-Requests"), out maxRequests);
             }


Checking LastWriteTime for NULL and added conditional formatting for year

--- FubarDev.FtpServer/ListFormatters/LongListFormatter.cs
+++ FubarDev.FtpServer/ListFormatters/LongListFormatter.cs
@@ -5,6 +5,7 @@
 // <author>Mark Junker</author>
 //-----------------------------------------------------------------------

+using System;
 using System.Globalization;

 using FubarDev.FtpServer.FileSystem;
@@ -25,9 +26,13 @@

         private static string BuildLine(IUnixFileSystemEntry entry, IUnixFileEntry fileEntry, string name)
         {
+            var lastWriteDate = entry.LastWriteTime ?? new DateTimeOffset(new DateTime(1970, 01, 01));
+            var format = lastWriteDate.Year == DateTimeOffset.UtcNow.Year
+                ? "{0}{1}{2}{3} {4} {5} {6} {7} {8:MMM dd HH:mm} {9}"
+                : "{0}{1}{2}{3} {4} {5} {6} {7} {8:MMM dd yyyy} {9}";
             return string.Format(
                 CultureInfo.InvariantCulture,
-                "{0}{1}{2}{3} {4} {5} {6} {7:D13} {8:MMM dd HH:mm} {9}",
+                format,
                 fileEntry == null ? "d" : "-",
                 BuildAccessMode(entry.Permissions.User),
                 BuildAccessMode(entry.Permissions.Group),
@@ -36,7 +41,7 @@
                 entry.Owner,
                 entry.Group,
                 fileEntry?.Size ?? 0,
-                entry.LastWriteTime,
+                lastWriteDate,
                 name);
         }


Fix NullPointerReference

Fix NullPointerReference

--- osu.Game.Rulesets.Taiko/Difficulty/Evaluators/StaminaEvaluator.cs
+++ osu.Game.Rulesets.Taiko/Difficulty/Evaluators/StaminaEvaluator.cs
@@ -2,8 +2,6 @@
 // See the LICENCE file in the repository root for full licence text.

 using osu.Game.Rulesets.Difficulty.Preprocessing;
-using osu.Game.Rulesets.Difficulty.Skills;
-using osu.Game.Rulesets.Mods;
 using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing;
 using osu.Game.Rulesets.Taiko.Objects;

@@ -42,19 +40,14 @@
             do
             {
                 previous = (TaikoDifficultyHitObject)previous.Previous(1);
+                if (previous == null) return 0; // No previous (The note is the first press of the current key)
                 if (previous.BaseObject is Hit && previous.HitType == taikoCurrent.HitType)
                 {
                     --monoNoteInterval;
                 }
                 currentKeyInterval += previous.DeltaTime;

-            } while (previous != null && monoNoteInterval > 0);
-
-            // This note is the first press of the current key
-            if (monoNoteInterval > 0)
-            {
-                return 0;
-            }
+            } while (monoNoteInterval > 0);

             double objectStrain = 0.5;
             objectStrain += speedBonus(currentKeyInterval);


Android: test added for event with multiple participants assigned

--- Android/MoneyBack.Android.Tests/RepositoryTests.cs
+++ Android/MoneyBack.Android.Tests/RepositoryTests.cs
@@ -78,14 +78,14 @@
                 PhoneNumber = "123456789"
             };

-
+
             // when
             var v1 = _dbContext.People.Insert(person1);
             var v2 = _dbContext.Events.Insert(event1);

-            person1.Events = new List<Event> {event1};
+            person1.Events = new List<Event> { event1 };
             _dbContext.People.UpdateWithChildren(person1);
-
+
             var personStored = _dbContext.People.GetWithChildren(person1.Id);
             var eventStored = _dbContext.Events.GetWithChildren(personStored.Events[0].Id);

@@ -94,5 +94,54 @@
             Assert.AreEqual(1, personStored.Events.Count);
             Assert.AreEqual(1, eventStored.Participants.Count);
         }
+
+        [Test]
+        public void two_persons_are_properly_saved_with_the_same_event()
+        {
+            // given
+            var event1 = new Event
+            {
+                Name = "Volleyball",
+                Date = new DateTime(2017, 06, 18),
+                Place = "Sports hall"
+            };
+
+            var person1 = new Person
+            {
+                Name = "A",
+                LastName = "B",
+                PhoneNumber = "123456789"
+            };
+
+            var person2 = new Person
+            {
+                Name = "B",
+                LastName = "C",
+                PhoneNumber = "333456789"
+            };
+
+
+            // when
+            var v1 = _dbContext.People.Insert(person1);
+            var v12 = _dbContext.People.Insert(person2);
+            var v2 = _dbContext.Events.Insert(event1);
+
+            person1.Events = new List<Event> { event1 }; // assign two different people to the same event
+            person2.Events = new List<Event> { event1 };
+            _dbContext.People.UpdateWithChildren(person1);
+            _dbContext.People.UpdateWithChildren(person2);
+
+            var personStored = _dbContext.People.GetWithChildren(person1.Id);
+            var person2Stored = _dbContext.People.GetWithChildren(person2.Id);
+            var eventStored = _dbContext.Events.GetWithChildren(personStored.Events[0].Id);
+
+            // then
+            Assert.Greater(personStored.Id, 1);
+            Assert.Greater(person2Stored.Id, 1);
+            Assert.AreEqual(1, personStored.Events.Count);
+            Assert.AreEqual(1, person2Stored.Events.Count);
+            Assert.AreEqual(personStored.Events[0].Id, person2Stored.Events[0].Id);
+            Assert.AreEqual(2, eventStored.Participants.Count);
+        }
     }
 }


[en] Updated test configuration for RecreateClientConnectionTests

git-tfs-id: [https://tfs.codeplex.com:443/tfs/TFS15]$/cyan;C19180

--- source/Zyan.Tests/RecreateClientConnectionTests.cs
+++ source/Zyan.Tests/RecreateClientConnectionTests.cs
@@ -96,7 +96,7 @@

             private TcpDuplexServerHostEnvironment()
             {
-                var protocol = new TcpDuplexServerProtocolSetup(8084, new NullAuthenticationProvider(), false);
+                var protocol = new TcpDuplexServerProtocolSetup(8084, new NullAuthenticationProvider(), true);
                 _host = new ZyanComponentHost("RecreateClientConnectionTestHost_TcpDuplex", protocol);
                 _host.RegisterComponent<ISampleServer, SampleServer>("SampleServer", ActivationType.SingleCall);
             }
@@ -155,7 +155,7 @@

             private TcpSimplexServerHostEnvironment()
             {
-                var protocol = new TcpCustomServerProtocolSetup(8085,new NullAuthenticationProvider(),false);
+                var protocol = new TcpCustomServerProtocolSetup(8085,new NullAuthenticationProvider(),true);
                 _host = new ZyanComponentHost("RecreateClientConnectionTestHost_TcpSimplex", protocol);
                 _host.RegisterComponent<ISampleServer, SampleServer>("SampleServer", ActivationType.SingleCall);
             }
@@ -319,7 +319,7 @@
         {
             string url = "tcp://localhost:8085/RecreateClientConnectionTestHost_TcpSimplex";

-            var protocol = new TcpCustomClientProtocolSetup(false);
+            var protocol = new TcpCustomClientProtocolSetup(true);
             ZyanConnection connection = new ZyanConnection(url, protocol);

             var proxy1 = connection.CreateProxy<ISampleServer>("SampleServer");


Removed redundant text mesh.

Removed redundant text mesh.

--- Assets/HoloToolkit/Utilities/Scripts/FpsDisplay.cs
+++ Assets/HoloToolkit/Utilities/Scripts/FpsDisplay.cs
@@ -14,10 +14,6 @@
         [Tooltip("Reference to Text UI control where the FPS should be displayed.")]
         [SerializeField]
         private TextMesh textMesh;
-
-        [Tooltip("Reference to 3DText UI control where the FPS should be displayed.")]
-        [SerializeField]
-        private TextMesh text3D;

         [Tooltip("How many frames should we consider into our average calculation?")]
         [SerializeField]
@@ -59,7 +55,7 @@
         {
             textMesh = GetComponent<TextMesh>();

-            if(frameRange <= 0)
+            if (frameRange <= 0)
             {
                 frameRange = 1;
             }
@@ -76,17 +72,13 @@
             {
                 textMesh.text = displayString;
             }
-            if (text3D != null)
-            {
-                text3D.text = displayString;
-            }
         }

         private void UpdateFrameBuffer()
         {
-            fpsBuffer[fpsBufferIndex++] = (int)(1f/Time.unscaledDeltaTime);
+            fpsBuffer[fpsBufferIndex++] = (int)(1f / Time.unscaledDeltaTime);

-            if(fpsBufferIndex >= frameRange)
+            if (fpsBufferIndex >= frameRange)
             {
                 fpsBufferIndex = 0;
             }
@@ -96,7 +88,7 @@
         {
             int sum = 0;

-            for(int i = 0; i < frameRange; i++)
+            for (int i = 0; i < frameRange; i++)
             {
                 int fps = fpsBuffer[i];
                 sum += fps;


:bulb: コメント力

:bulb: コメント力

--- Assets/Metro/Scripts/InputSystems/InputSettings.cs
+++ Assets/Metro/Scripts/InputSystems/InputSettings.cs
@@ -11,16 +11,28 @@
         [SerializeField]
         private float tapDistance;

+        /// <summary>
+        /// タップを許容する入力時間
+        /// </summary>
+        /// <remarks>
+        /// タッチを開始した時間と終了した時間がこの値より小さい場合はタップしたとみなします
+        /// </remarks>
         public float TapDuration
         {
             get { return tapDuration; }
             private set { this.tapDuration = Mathf.Max(0.1f, value); }
         }

+        /// <summary>
+        /// タップを許容する距離
+        /// </summary>
+        /// <remarks>
+        /// 最初にタッチした座標と最後の座標との距離を領域のサイズで正規化した値がこの値より小さい場合はタップとみなします
+        /// </remarks>
         public float TapDistance
         {
             get { return this.tapDistance; }
-            private set { this.tapDistance = Mathf.Max(0.1f, value); }
+            private set { this.tapDistance = Mathf.Max(0.0f, value); }
         }

         void OnValidate()


Register undo operations on screen shooter window

--- Assets/ScreenShooter/Editor/ScreenShooterWindow.cs
+++ Assets/ScreenShooter/Editor/ScreenShooterWindow.cs
@@ -99,12 +99,16 @@
         {
             _hasErrors = false;
             GUI.changed = false;
-            GUI.enabled = !_isMakingScreenshotsNow;
+            GUI.enabled = !_isMakingScreenshotsNow;
+
+            Undo.RecordObject(_settings, "ScreenShooter settings");

             OnGUICameraInput();
             OnGUIScreenshotsList();
             OnGUISaveFolderInput();
             OnGUITakeButton();
+
+            if (GUI.changed) EditorUtility.SetDirty(_settings);
         }

         //---------------------------------------------------------------------
@@ -172,8 +176,6 @@
             {
                 EditorCoroutine.Start(TakeScreenshots());
             }
-
-            if (GUI.changed) EditorUtility.SetDirty(_settings);
         }

         [SuppressMessage("ReSharper", "PossibleLossOfFraction")]


added word "affected" to buff

added word "affected" to buff

--- Assets/Scripts/Game/Defined/Serialized/BuffList.cs
+++ Assets/Scripts/Game/Defined/Serialized/BuffList.cs
@@ -285,7 +285,7 @@
             : base(duration,
                   Util.GetSprite(spriteLoc),
                   name,
-                  string.Format("On time-out, unit loses ALL {0}.", affectedStat.ColoredName),
+                  string.Format("On time-out, affected unit loses ALL {0}.", affectedStat.ColoredName),
                   true) {
             this.affectedStat = affectedStat;
         }


Minigame Gula: Duração aumentada

Minigame Gula: Duração aumentada

--- Assets/Scripts/Mini_Gula/MinigameGulaController.cs
+++ Assets/Scripts/Mini_Gula/MinigameGulaController.cs
@@ -24,7 +24,7 @@
     private bool hasGameEnded;

     // Dificuldade
-    private static int difficulty = 4;
+    private static int difficulty = 5;

     // Constantes
     private const int MEIO = 0, ESQUERDA = 1, DIREITA = 2;
@@ -93,34 +93,34 @@
         switch (difficulty)
         {
             case 1:
-                nTotalFoods = 5;
-                nBadFoods = 1;
-                nGoodFoods = 4;
-                globalFoodSpeed = 20;
-                break;
-            case 2:
                 nTotalFoods = 10;
                 nBadFoods = 3;
                 nGoodFoods = 7;
-                globalFoodSpeed = 20;
-                break;
-
-            case 3:
-                nTotalFoods = 20;
+                globalFoodSpeed = 15;
+                break;
+            case 2:
+                nTotalFoods = 15;
                 nBadFoods = 5;
                 nGoodFoods = 10;
                 globalFoodSpeed = 20;
                 break;
+
+            case 3:
+                nTotalFoods = 25;
+                nBadFoods = 10;
+                nGoodFoods = 15;
+                globalFoodSpeed = 20;
+                break;
             case 4:
-                nTotalFoods = 30;
-                nBadFoods = 10;
+                nTotalFoods = 35;
+                nBadFoods = 15;
                 nGoodFoods = 20;
                 globalFoodSpeed = 20;
                 break;
             case 5:
-                nTotalFoods = 40;
-                nBadFoods = 10;
-                nGoodFoods = 30;
+                nTotalFoods = 45;
+                nBadFoods = 20;
+                nGoodFoods = 25;
                 globalFoodSpeed = 25;
                 break;
         }


Commit the newest changes to "Script State Serialization doesn't escape double quotes" by tsudico, thanks!

--- Aurora/AuroraDotNetEngine/ScriptBase/ScriptBase.cs
+++ Aurora/AuroraDotNetEngine/ScriptBase/ScriptBase.cs
@@ -283,7 +283,25 @@
             int i = tmp.LastIndexOf('+');
             string type = tmp.Substring(i + 1);
             return type;
-        }
+        }
+
+        #region String Escaping for Save/Load States
+
+        public string EscapeString(string str)
+        {
+            // Must escape string for lists
+            // This escapes double quotes first, then backslashes
+            return str.Replace("\"", "\\\"").Replace("\\", "\\\\");
+        }
+
+        public string UnEscapeString(string str)
+        {
+            // Must do the opposite of EscapeString
+            // This unescapes backslashes first, then quotes
+            return str.Replace("\\\\", "\\").Replace("\\\"", "\"");
+        }
+
+        #endregion

         public string ListToString(object o)
         {
@@ -301,7 +319,7 @@
                 else if (ob.GetType() == typeof(LSL_Types.Quaternion))
                     cur = "q" + ob;
                 else if (ob.GetType() == typeof(LSL_Types.LSLString))
-                    cur = "\"" + ob + "\"";
+                    cur = "\"" + EscapeString(ob.ToString()) + "\"";
                 else if (ob.GetType() == typeof (LSL_Types.key))
                     cur = "k\"" + ob + "\"";
                 else if (o.GetType() == typeof(LSL_Types.list))
@@ -346,7 +364,7 @@
                         else if (o.GetType() == typeof(LSL_Types.Quaternion))
                             cur = "q" + o;
                         else if (o.GetType() == typeof(LSL_Types.LSLString))
-                            cur = "\"" + o + "\"";
+                            cur = "\"" + EscapeString(o.ToString()) + "\"";
                         else if (o.GetType() == typeof (LSL_Types.key))
                             cur = "k\"" + o + "\"";
                         else if (o.GetType() == typeof(LSL_Types.list))
@@ -390,7 +408,8 @@
             string param = "";
             int totlen = inval.Length;
             int len;
-
+            DateTime time_limit = DateTime.Now.AddSeconds(5.0);
+
             while (true)
             {
                 try
@@ -442,11 +461,21 @@
                                 break;
                             case '"':
                                 end = inval.IndexOf('"', start);
+                                while (inval[end - 1] == '\\')
+                                {
+                                    int slashes = 2;
+                                    while(end - slashes > 0 && inval[end - slashes] == '\\')
+                                        slashes++;
+                                    if ((slashes - 1) % 2 == 0)
+                                        end = inval.IndexOf('"', end + 1);
+                                    else
+                                        break;
+                                }
                                 if (end > 0)
                                     len = end - start;
                                 else
                                     len = totlen - start;
-                                param = inval.Substring(start, len);
+                                param = UnEscapeString(inval.Substring(start, len));
                                 v.Add(new LSL_Types.LSLString(param));
                                 end++;
                                 break;
@@ -474,8 +503,10 @@
                     if (start == -1 || start >= totlen || (inval[start] == '}'))
                         break;
                     else
-                        while (inval[start] == ',' || inval[start] == ' ')
-                            start++;
+                        while ((inval[start] == ',' || inval[start] == ' ') && DateTime.Now.CompareTo(time_limit) < 0)
+                             start++;
+                    if (DateTime.Now.CompareTo(time_limit) < 0)
+                        break;
                 }
                 catch
                 {


Redirect instead of show 404 on 0 amount invoices

fixes #3904

--- BTCPayServer/Controllers/UIInvoiceController.UI.cs
+++ BTCPayServer/Controllers/UIInvoiceController.UI.cs
@@ -601,12 +601,14 @@
             if (invoiceId is null)
                 return NotFound();
             var model = await GetInvoiceModel(invoiceId, paymentMethodId == null ? null : PaymentMethodId.Parse(paymentMethodId), lang);
-            if (model == null)
+            if (model.Item2 != null)
+                return Redirect(model.Item2);
+            else if(model.Item1 == null)
                 return NotFound();

             if (view == "modal")
-                model.IsModal = true;
-            return View(nameof(Checkout), model);
+                model.Item1.IsModal = true;
+            return View(nameof(Checkout), model.Item1);
         }

         [HttpGet("invoice-noscript")]
@@ -618,21 +620,39 @@
             if (invoiceId is null)
                 return NotFound();
             var model = await GetInvoiceModel(invoiceId, paymentMethodId is null ? null : PaymentMethodId.Parse(paymentMethodId), lang);
-            if (model == null)
-                return NotFound();
-
-            return View(model);
-        }
-
-        private async Task<PaymentModel?> GetInvoiceModel(string invoiceId, PaymentMethodId? paymentMethodId, string? lang)
+            if (model.Item2 != null)
+                return Redirect(model.Item2);
+            else if(model.Item1 == null)
+                return NotFound();
+
+            return View(model.Item1);
+        }
+
+        private async Task<(PaymentModel?, string?)> GetInvoiceModel(string invoiceId, PaymentMethodId? paymentMethodId, string? lang)
         {
             var invoice = await _InvoiceRepository.GetInvoice(invoiceId);
             if (invoice == null)
-                return null;
+                return (null, null);

             var store = await _StoreRepository.FindStore(invoice.StoreId);
             if (store == null)
-                return null;
+                return (null, null);
+
+            var storeBlob = store.GetStoreBlob();
+            var receiptEnabled = InvoiceDataBase.ReceiptOptions.Merge(storeBlob.ReceiptOptions, invoice.ReceiptOptions).Enabled is true;
+            var receiptUrl = receiptEnabled? _linkGenerator.GetUriByAction(
+                nameof(UIInvoiceController.InvoiceReceipt),
+                "UIInvoice",
+                new {invoiceId},
+                Request.Scheme,
+                Request.Host,
+                Request.PathBase) : null;
+            if (invoice.Status == InvoiceStatusLegacy.Complete && invoice.Price == 0 &&
+                !invoice.GetPaymentMethods().Any())
+            {
+                return (null, invoice.RedirectURL?.AbsoluteUri ?? receiptUrl ?? "/");
+            }
+

             bool isDefaultPaymentId = false;
             if (paymentMethodId is null)
@@ -667,19 +687,19 @@
                 isDefaultPaymentId = true;
             }
             if (paymentMethodId is null)
-                return null;
+                return (null, null);
             BTCPayNetworkBase network = _NetworkProvider.GetNetwork<BTCPayNetworkBase>(paymentMethodId.CryptoCode);
             if (network is null || !invoice.Support(paymentMethodId))
             {
                 if (!isDefaultPaymentId)
-                    return null;
+                    return (null, null);
                 var paymentMethodTemp = invoice
                     .GetPaymentMethods()
                     .FirstOrDefault(c => paymentMethodId.CryptoCode == c.GetId().CryptoCode);
                 if (paymentMethodTemp == null)
                     paymentMethodTemp = invoice.GetPaymentMethods().FirstOrDefault();
                 if (paymentMethodTemp is null)
-                    return null;
+                    return (null, null);
                 network = paymentMethodTemp.Network;
                 paymentMethodId = paymentMethodTemp.GetId();
             }
@@ -695,7 +715,6 @@
                 }
             }
             var dto = invoice.EntityToDTO();
-            var storeBlob = store.GetStoreBlob();
             var accounting = paymentMethod.Calculate();

             var paymentMethodHandler = _paymentMethodHandlerDictionary[paymentMethodId];
@@ -716,14 +735,6 @@
             }
             lang ??= storeBlob.DefaultLang;

-            var receiptEnabled = InvoiceDataBase.ReceiptOptions.Merge(storeBlob.ReceiptOptions, invoice.ReceiptOptions).Enabled is true;
-            var receiptUrl = receiptEnabled? _linkGenerator.GetUriByAction(
-                nameof(UIInvoiceController.InvoiceReceipt),
-                "UIInvoice",
-                new {invoiceId},
-                Request.Scheme,
-                Request.Host,
-                Request.PathBase) : null;

             var model = new PaymentModel
             {
@@ -799,7 +810,7 @@
             model.PaymentMethodId = paymentMethodId.ToString();
             var expiration = TimeSpan.FromSeconds(model.ExpirationSeconds);
             model.TimeLeft = expiration.PrettyPrint();
-            return model;
+            return (model, null);
         }

         private string? OrderAmountFromInvoice(string cryptoCode, InvoiceEntity invoiceEntity)
@@ -826,7 +837,7 @@
             if (string.IsNullOrEmpty(paymentMethodId))
                 paymentMethodId = implicitPaymentMethodId;
             var model = await GetInvoiceModel(invoiceId, paymentMethodId == null ? null : PaymentMethodId.Parse(paymentMethodId), lang);
-            if (model == null)
+            if (model.Item1 == null)
                 return NotFound();
             return Json(model);
         }


ReSharpers suggestions have been applied.

--- test/BackLINQ.Tests/EnumerableFixture.cs
+++ test/BackLINQ.Tests/EnumerableFixture.cs
@@ -69,14 +69,14 @@

         [Test]
         public void Aggregate_FuncArg_ValidArguments_CorrectResult() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
             var result = source.Aggregate((a, b) => a + b);
             Assert.That(result, Is.EqualTo(55));
         }

         [Test]
         public void Aggregate_AccumulatorArgFuncArg_ValidArguments_CorrectResult() {
-            var source = new OnceEnumerable<int>(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
+            var source = new OnceEnumerable<int>(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
             var result = source.Aggregate(100, (a, b) => a + b);
             Assert.That(result, Is.EqualTo(155));
         }
@@ -101,7 +101,7 @@
         [Test]
         [ExpectedException(typeof(InvalidCastException))]
         public void Cast_InvalidSource_ThrowsInvalidCastException() {
-            var list = new OnceEnumerable<object>( new List<object>() {1000, "hello", new object()});
+            var list = new OnceEnumerable<object>( new List<object> {1000, "hello", new object()});
             IEnumerable<byte> target = Enumerable.Cast<byte>(list);
             // do something with the results so Cast will really be executed (deferred execution)
             StringBuilder sb = new StringBuilder();
@@ -113,14 +113,14 @@
         /// Tests a downcast from object to int.
         [Test]
         public void Cast_ValidArguments_CorrectResult() {
-            var source = new OnceEnumerable<object>(new List<object>() {1, 10, 100});
+            var source = new OnceEnumerable<object>(new List<object> {1, 10, 100});
             Enumerable.Cast<int>(source).Compare(1, 10, 100);
         }

         /// Tests an upcast from int to object.
         [Test]
         public void Cast_ArrayOfInts_CorrectCastToObjects() {
-            Enumerable.Cast<object>(new OnceEnumerable<int>(new int[] {1, 10, 100})).Compare(1, 10, 100);
+            Enumerable.Cast<object>(new OnceEnumerable<int>(new[] {1, 10, 100})).Compare(1, 10, 100);
         }

         [Test]
@@ -133,13 +133,13 @@

         [Test]
         public void All_ArgumentsNotSatifyingCondition_ReturnsFalse() {
-            var source = new OnceEnumerable<int>(new List<int>() {-100, -1, 0, 1, 100});
+            var source = new OnceEnumerable<int>(new List<int> {-100, -1, 0, 1, 100});
             Assert.That(Enumerable.All(source, i => i >= 0), Is.False);
         }

         [Test]
         public void All_ArgumentsSatisfyingCondition_ReturnsTrue() {
-            var source = new OnceEnumerable<int>(new List<int>() { -100, -1, 0, 1, 100 });
+            var source = new OnceEnumerable<int>(new List<int> { -100, -1, 0, 1, 100 });
             Assert.That(Enumerable.All(source, i => i >= -100), Is.True);
         }

@@ -180,32 +180,32 @@

         [Test]
         public void Average_Decimals_CorrectResult() {
-            var source = new OnceEnumerable<decimal>(new List<decimal>() {-10000, 2.0001m, 50});
+            var source = new OnceEnumerable<decimal>(new List<decimal> {-10000, 2.0001m, 50});
             Assert.That(source.Average(), Is.EqualTo(-3315.999966).Within(0.00001));
         }

         [Test]
         [ExpectedException(typeof(ArgumentNullException))]
         public void Concat_FirstArgumentNull_ThrowsArgumentNullException() {
-            Enumerable.Concat(null, new int[] {3, 5});
+            Enumerable.Concat(null, new[] {3, 5});
         }

         [Test]
         [ExpectedException(typeof(ArgumentNullException))]
         public void Concat_SecondArgumentNull_ThrowsArgumentNullException() {
-            var result = Enumerable.Concat(new int[] { 3, 5 }, null);
+            Enumerable.Concat(new[] { 3, 5 }, null);
         }

         [Test]
         public void Concat_TwoLists_CorrectOrder() {
-            var list1 = new OnceEnumerable<int>(new int[] {1, 2, 3});
-            var list2 = new OnceEnumerable<int>(new int[] {4, 5, 6});
+            var list1 = new OnceEnumerable<int>(new[] {1, 2, 3});
+            var list2 = new OnceEnumerable<int>(new[] {4, 5, 6});
             Enumerable.Concat(list1, list2).Compare(1, 2, 3, 4, 5, 6);
         }

         [Test]
         public void DefaultIfEmpty_NotEmpty_ReturnsItself() {
-            var source = new OnceEnumerable<int>(new int[] { 1, 2, 3 });
+            var source = new OnceEnumerable<int>(new[] { 1, 2, 3 });
             source.DefaultIfEmpty(1).Compare(1, 2, 3);
         }

@@ -223,7 +223,7 @@

         [Test]
         public void DefaultIfEmpty_DefaultValue_NotEmpty_ReturnsItself() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3});
             source.DefaultIfEmpty(5).Compare(1, 2, 3);
         }

@@ -235,26 +235,26 @@

         [Test]
         public void Distinct_ArgumentWithNonDistinctValues_ReturnsOnlyDistinctValues() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 2, 3});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 2, 3});
             source.Distinct().Compare(1, 2, 3);
         }

         [Test]
         public void Distinct_ComparerArg_NonDistinctValues_ReturnsOnlyDistinctValues() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 2, 3});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 2, 3});
             source.Distinct(EqualityComparer<int>.Default).Compare(1, 2, 3);
         }

         [Test]
         [ExpectedException(typeof(ArgumentOutOfRangeException))]
         public void ElementAt_ArgumentOutOfRange_ThrowsArgumentOutOfRangeException() {
-            var source = new OnceEnumerable<int>(new int[] {3, 5, 7});
+            var source = new OnceEnumerable<int>(new[] {3, 5, 7});
             source.ElementAt(3);
         }

         [Test]
         public void ElementAt_ValidArguments_ReturnsCorrectValues() {
-            var source = new int[] {15, 2, 7};
+            var source = new[] {15, 2, 7};
             Assert.That(source.ElementAt(0), Is.EqualTo(15));
             Assert.That(source.ElementAt(1), Is.EqualTo(2));
             Assert.That(source.ElementAt(2), Is.EqualTo(7));
@@ -262,19 +262,19 @@

         [Test]
         public void ElementAtOrDefault_IntArray_ReturnsZeroIfIndexOutOfRange() {
-            var source = new OnceEnumerable<int>(new int[] {3, 6, 8});
+            var source = new OnceEnumerable<int>(new[] {3, 6, 8});
             Assert.That(source.ElementAtOrDefault(3), Is.EqualTo(0));
         }

         [Test]
         public void ElementAtOrDefault_IntArray_ReturnsCorrectValue() {
-            var source = new OnceEnumerable<int>(new int[] {3, 6, 9});
+            var source = new OnceEnumerable<int>(new[] {3, 6, 9});
             Assert.That(source.ElementAtOrDefault(2), Is.EqualTo(9));
         }

         [Test]
         public void ElementAtOrDefault_ObjectArray_ReturnsNullIfIndexOutOfRange() {
-            var source = new OnceEnumerable<object>(new object[] {new object(), new object()});
+            var source = new OnceEnumerable<object>(new[] {new object(), new object()});
             Assert.That(source.ElementAtOrDefault(2), Is.EqualTo(null));
         }

@@ -282,28 +282,28 @@
         public void ElementAtOrDefault_ObjectArray_ReturnsCorrectValue() {
             object obj1 = new object();
             object obj2 = new object();
-            var source = new OnceEnumerable<object>(new object[] {obj1, obj2});
+            var source = new OnceEnumerable<object>(new[] {obj1, obj2});
             Assert.That(source.ElementAt(0), Is.EqualTo(obj1));
         }

         [Test]
         [ExpectedException(typeof(ArgumentNullException))]
         public void Except_secondArg_ArgumentNull_ThrowsArgumentNullException() {
-            var source = new OnceEnumerable<int>(new int[] {1, 4, 7});
+            var source = new OnceEnumerable<int>(new[] {1, 4, 7});
             source.Except(null);
         }

         [Test]
         public void Except_secondArg_ValidArgument_ReturnsCorrectEnumerable() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
-            var argument = new OnceEnumerable<int>(new int[] {1, 3, 5, 7, 9});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
+            var argument = new OnceEnumerable<int>(new[] {1, 3, 5, 7, 9});
             source.Except(argument).Compare(2, 4, 6, 8, 10);
         }

         [Test]
         public void Except_secondArgComparerArg_ComparerIsUsed() {
-            var source = new OnceEnumerable<string>( new string[] {"albert", "john", "simon"});
-            var argument = new OnceEnumerable<string>(new string[] {"ALBERT"});
+            var source = new OnceEnumerable<string>( new[] {"albert", "john", "simon"});
+            var argument = new OnceEnumerable<string>(new[] {"ALBERT"});
             source.Except(argument, StringComparer.CurrentCultureIgnoreCase).Compare("john", "simon");
         }

@@ -316,20 +316,20 @@

         [Test]
         public void First_IntArray_ReturnsFirst() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4});
             Assert.That(source.First(), Is.EqualTo(1));
         }

         [Test]
         public void First_PredicateArg_IntArray_PredicateIsUsed() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4});
             Assert.That(source.First(i => i%2 == 0), Is.EqualTo(2));
         }

         [Test]
         [ExpectedException(typeof(InvalidOperationException))]
         public void First_PredicateArg_NoElementMatches_InvalidOperationExceptionIsThrown() {
-            var source = new OnceEnumerable<int>(new int[] { 1, 2, 3, 4 });
+            var source = new OnceEnumerable<int>(new[] { 1, 2, 3, 4 });
             Assert.That(source.First(i => i > 5), Is.EqualTo(0));
         }

@@ -343,26 +343,26 @@
         public void FirstOrDefault_ObjectArray_FirstIsReturned() {
             object obj1 = new object();
             object obj2 = new object();
-            var source = new OnceEnumerable<object>(new object[] {obj1, obj2});
+            var source = new OnceEnumerable<object>(new[] {obj1, obj2});
             Assert.That(source.FirstOrDefault(), Is.EqualTo(obj1));
         }

         [Test]
         [ExpectedException(typeof(ArgumentNullException))]
         public void FirstOrDefault_PredicateArg_NullAsPredicate_ArgumentNullExceptionIsThrown() {
-            var source = new int[] {3, 5, 7};
+            var source = new[] {3, 5, 7};
             source.FirstOrDefault(null);
         }

         [Test]
         public void FirstOrDefault_PredicateArg_ValidPredicate_FirstMatchingItemIsReturned() {
-            var source = new OnceEnumerable<int>(new int[] {1, 4, 8});
+            var source = new OnceEnumerable<int>(new[] {1, 4, 8});
             Assert.That(source.FirstOrDefault(i => i%2 == 0), Is.EqualTo(4));
         }

         [Test]
         public void FirstOrDefault_PredicateArg_NoMatchesInArray_DefaultValueOfTypeIsReturned() {
-            var source = new OnceEnumerable<int>(new int[] {1, 4, 6});
+            var source = new OnceEnumerable<int>(new[] {1, 4, 6});
             Assert.That(source.FirstOrDefault(i => i > 10), Is.EqualTo(0));
         }

@@ -371,12 +371,12 @@
             public string FamilyName { get; set; }
             public int Age { get; set; }
             public static Person[] CreatePersons() {
-                return new Person[]
+                return new[]
                            {
-                               new Person() {FamilyName = "Müller", FirstName = "Peter", Age = 21},
-                               new Person() {FamilyName = "Müller", FirstName = "Herbert", Age = 22},
-                               new Person() {FamilyName = "Meier", FirstName = "Hubert", Age = 23},
-                               new Person() {FamilyName = "Meier", FirstName = "Isidor", Age = 24}
+                               new Person {FamilyName = "Müller", FirstName = "Peter", Age = 21},
+                               new Person {FamilyName = "Müller", FirstName = "Herbert", Age = 22},
+                               new Person {FamilyName = "Meier", FirstName = "Hubert", Age = 23},
+                               new Person {FamilyName = "Meier", FirstName = "Isidor", Age = 24}
                            };
             }
         }
@@ -413,14 +413,14 @@
         [Test]
         // TODO: make better
         public void GroupBy_KeySelectorArg_ValidArguments_CorrectCaseSensitiveGrouping() {
-            var persons = new OnceEnumerable<Person>( new Person[]
+            var persons = new OnceEnumerable<Person>( new[]
                                  {
-                                     new Person() {FamilyName = "Müller", FirstName = "Peter"},
-                                     new Person() {FamilyName = "müller", FirstName = "Herbert"},
-                                     new Person() {FamilyName = "Meier", FirstName = "Hubert"},
-                                     new Person() {FamilyName = "meier", FirstName = "Isidor"}
+                                     new Person {FamilyName = "Müller", FirstName = "Peter"},
+                                     new Person {FamilyName = "müller", FirstName = "Herbert"},
+                                     new Person {FamilyName = "Meier", FirstName = "Hubert"},
+                                     new Person {FamilyName = "meier", FirstName = "Isidor"}
                                  });
-            var result = persons.GroupBy<Person, String>(person => person.FamilyName);
+            var result = persons.GroupBy(person => person.FamilyName);
             var enumerator = result.GetEnumerator();
             enumerator.MoveNext();
             Assert.That(enumerator.Current.Key, Is.EqualTo("Müller"));
@@ -440,14 +440,14 @@

         [Test]
         public void GroupBy_KeySelectorArgComparerArg_KeysThatDifferInCasingNonCaseSensitiveStringComparer_CorrectGrouping() {
-            var persons = new OnceEnumerable<Person>( new Person[]
+            var persons = new OnceEnumerable<Person>( new[]
                                  {
-                                     new Person() {FamilyName = "Müller", FirstName = "Peter"},
-                                     new Person() {FamilyName = "müller", FirstName = "Herbert"},
-                                     new Person() {FamilyName = "Meier", FirstName = "Hubert"},
-                                     new Person() {FamilyName = "meier", FirstName = "Isidor"}
+                                     new Person {FamilyName = "Müller", FirstName = "Peter"},
+                                     new Person {FamilyName = "müller", FirstName = "Herbert"},
+                                     new Person {FamilyName = "Meier", FirstName = "Hubert"},
+                                     new Person {FamilyName = "meier", FirstName = "Isidor"}
                                  });
-            var result = persons.GroupBy<Person, String>(person => person.FamilyName, StringComparer.InvariantCultureIgnoreCase);
+            var result = persons.GroupBy(person => person.FamilyName, StringComparer.InvariantCultureIgnoreCase);
             var enumerator = result.GetEnumerator();
             enumerator.MoveNext();
             Assert.That(enumerator.Current.Key, Is.EqualTo("Müller"));
@@ -482,8 +482,8 @@
         public void GroupBy_KeySelectorArgResultSelectorArg_ValidArguments_CorrectGroupingProcessing() {
             var persons = new OnceEnumerable<Person>(Person.CreatePersons());

-            IEnumerable<int> result = persons.GroupBy<Person, string, int>(person => person.FamilyName,
-                                                (string key, IEnumerable<Person> group) => {
+            IEnumerable<int> result = persons.GroupBy(person => person.FamilyName,
+                                                (key, group) => {
                                                     int ageSum = 0;
                                                     foreach(Person p in group) {
                                                         ageSum += p.Age;
@@ -495,15 +495,15 @@

         [Test]
         public void GroupByKey_KeySelectorArgElementSelectorArgComparerArg_ValidArguments_CorrectGroupingAndProcessing() {
-            var persons = new OnceEnumerable<Person>( new Person[]
+            var persons = new OnceEnumerable<Person>( new[]
                                  {
-                                     new Person() {FamilyName = "Müller", FirstName = "Peter", Age = 21},
-                                     new Person() {FamilyName = "müller", FirstName = "Herbert", Age = 22},
-                                     new Person() {FamilyName = "Meier", FirstName = "Hubert", Age= 23},
-                                     new Person() {FamilyName = "meier", FirstName = "Isidor", Age = 24}
+                                     new Person {FamilyName = "Müller", FirstName = "Peter", Age = 21},
+                                     new Person {FamilyName = "müller", FirstName = "Herbert", Age = 22},
+                                     new Person {FamilyName = "Meier", FirstName = "Hubert", Age= 23},
+                                     new Person {FamilyName = "meier", FirstName = "Isidor", Age = 24}
                                  });

-            IEnumerable<IGrouping<string, int>> result = persons.GroupBy<Person, string, int>(person => person.FamilyName,
+            IEnumerable<IGrouping<string, int>> result = persons.GroupBy(person => person.FamilyName,
                                                 person => person.Age,
                                                 StringComparer.CurrentCultureIgnoreCase);
             IEnumerator<IGrouping<string, int>> enumerator = result.GetEnumerator();
@@ -519,8 +519,8 @@
         [Test]
         public void GroupBy_KeySelectorArgElementSelectorArgResultSelectorArg_ValidArguments_CorrectGroupingAndTransforming() {
             var persons = new OnceEnumerable<Person>(Person.CreatePersons());
-            var result = persons.GroupBy<Person, string, int, int>(p => p.FamilyName, p => p.Age,
-                                                                      (string name, IEnumerable<int> enumerable2) => {
+            var result = persons.GroupBy(p => p.FamilyName, p => p.Age,
+                                                                      (name, enumerable2) => {
                                                                           int totalAge = 0;
                                                                           foreach (var i in enumerable2) {
                                                                               totalAge += i;
@@ -532,15 +532,15 @@

         [Test]
         public void GroupBy_KeySelectorArgResultSelectorArgComparerArg_ValidArguments_CorrectGroupingAndTransforming() {
-            var persons = new OnceEnumerable<Person>( new Person[]
+            var persons = new OnceEnumerable<Person>( new[]
                                  {
-                                     new Person() {FamilyName = "Müller", FirstName = "Peter", Age = 21},
-                                     new Person() {FamilyName = "müller", FirstName = "Herbert", Age = 22},
-                                     new Person() {FamilyName = "Meier", FirstName = "Hubert", Age= 23},
-                                     new Person() {FamilyName = "meier", FirstName = "Isidor", Age = 24}
+                                     new Person {FamilyName = "Müller", FirstName = "Peter", Age = 21},
+                                     new Person {FamilyName = "müller", FirstName = "Herbert", Age = 22},
+                                     new Person {FamilyName = "Meier", FirstName = "Hubert", Age= 23},
+                                     new Person {FamilyName = "meier", FirstName = "Isidor", Age = 24}
                                  });
-            var result = persons.GroupBy<Person, string, int>(p => p.FamilyName,
-                                                                      (string name, IEnumerable<Person> enumerable2) => {
+            var result = persons.GroupBy(p => p.FamilyName,
+                                                                      (name, enumerable2) => {
                                                                           int totalAge = 0;
                                                                           foreach (var i in enumerable2) {
                                                                               totalAge += i.Age;
@@ -553,15 +553,15 @@

         [Test]
         public void GroupBy_KeySelectorArgElementSelectorArgResultSelectorArgComparerArg_ValidArguments_CorrectGroupingAndTransforming() {
-            var persons = new OnceEnumerable<Person>(new Person[]
+            var persons = new OnceEnumerable<Person>(new[]
                                  {
-                                     new Person() {FamilyName = "Müller", FirstName = "Peter", Age = 21},
-                                     new Person() {FamilyName = "müller", FirstName = "Herbert", Age = 22},
-                                     new Person() {FamilyName = "Meier", FirstName = "Hubert", Age= 23},
-                                     new Person() {FamilyName = "meier", FirstName = "Isidor", Age = 24}
+                                     new Person {FamilyName = "Müller", FirstName = "Peter", Age = 21},
+                                     new Person {FamilyName = "müller", FirstName = "Herbert", Age = 22},
+                                     new Person {FamilyName = "Meier", FirstName = "Hubert", Age= 23},
+                                     new Person {FamilyName = "meier", FirstName = "Isidor", Age = 24}
                                  });
-            var result = persons.GroupBy<Person, string, int, int>(p => p.FamilyName, p => p.Age,
-                                                                      (string name, IEnumerable<int> enumerable2) => {
+            var result = persons.GroupBy(p => p.FamilyName, p => p.Age,
+                                                                      (name, enumerable2) => {
                                                                           int totalAge = 0;
                                                                           foreach (var i in enumerable2) {
                                                                               totalAge += i;
@@ -578,20 +578,20 @@

         [Test]
         public void GroupJoin_InnerArgOuterKeySelectorArgInnerKeySelectorArgResultSelectorArg_ValidArguments_CorrectGroupingAndJoining() {
-            var persons = new OnceEnumerable<Person>( new Person[]
+            var persons = new OnceEnumerable<Person>( new[]
                                  {
-                                     new Person() {FamilyName = "Müller", FirstName = "Peter", Age = 21},
-                                     new Person() {FamilyName = "müller", FirstName = "Herbert", Age = 22},
-                                     new Person() {FamilyName = "Meier", FirstName = "Hubert", Age= 23},
-                                     new Person() {FamilyName = "meier", FirstName = "Isidor", Age = 24}
+                                     new Person {FamilyName = "Müller", FirstName = "Peter", Age = 21},
+                                     new Person {FamilyName = "müller", FirstName = "Herbert", Age = 22},
+                                     new Person {FamilyName = "Meier", FirstName = "Hubert", Age= 23},
+                                     new Person {FamilyName = "meier", FirstName = "Isidor", Age = 24}
                                  });

-            var pets = new OnceEnumerable<Pet>( new Pet[]
+            var pets = new OnceEnumerable<Pet>( new[]
                            {
-                               new Pet() {Name = "Barley", Owner = "Peter"},
-                               new Pet() {Name = "Boots", Owner = "Herbert"},
-                               new Pet() {Name = "Whiskers", Owner = "Herbert"},
-                               new Pet() {Name = "Daisy", Owner = "Isidor"}
+                               new Pet {Name = "Barley", Owner = "Peter"},
+                               new Pet {Name = "Boots", Owner = "Herbert"},
+                               new Pet {Name = "Whiskers", Owner = "Herbert"},
+                               new Pet {Name = "Daisy", Owner = "Isidor"}
                            });

             var result = persons.GroupJoin(pets, person => person.FirstName, pet => pet.Owner,
@@ -631,20 +631,20 @@
         [Ignore("Pending resolution of issue #14 (http://code.google.com/p/backlinq/issues/detail?id=14).")]
         public void GroupJoin_InnerArgOuterKeySelectorArgInnerKeySelectorArgResultSelectorArgComparerArg_ValidArguments_CorrectGroupingAndJoining()
         {
-            var persons = new OnceEnumerable<Person>( new Person[]
+            var persons = new OnceEnumerable<Person>( new[]
                                  {
-                                     new Person() {FamilyName = "Müller", FirstName = "Peter", Age = 21},
-                                     new Person() {FamilyName = "müller", FirstName = "Herbert", Age = 22},
-                                     new Person() {FamilyName = "Meier", FirstName = "Hubert", Age= 23},
-                                     new Person() {FamilyName = "meier", FirstName = "Isidor", Age = 24}
+                                     new Person {FamilyName = "Müller", FirstName = "Peter", Age = 21},
+                                     new Person {FamilyName = "müller", FirstName = "Herbert", Age = 22},
+                                     new Person {FamilyName = "Meier", FirstName = "Hubert", Age= 23},
+                                     new Person {FamilyName = "meier", FirstName = "Isidor", Age = 24}
                                  });

-            var pets = new OnceEnumerable<Pet>( new Pet[]
+            var pets = new OnceEnumerable<Pet>( new[]
                            {
-                               new Pet() {Name = "Barley", Owner = "Peter"},
-                               new Pet() {Name = "Boots", Owner = "Herbert"},
-                               new Pet() {Name = "Whiskers", Owner = "herbert"}, // This pet is not associated to "Herbert"
-                               new Pet() {Name = "Daisy", Owner = "Isidor"}
+                               new Pet {Name = "Barley", Owner = "Peter"},
+                               new Pet {Name = "Boots", Owner = "Herbert"},
+                               new Pet {Name = "Whiskers", Owner = "herbert"}, // This pet is not associated to "Herbert"
+                               new Pet {Name = "Daisy", Owner = "Isidor"}
                            });

             var result = persons.GroupJoin(pets, person => person.FirstName, pet => pet.Owner,
@@ -675,46 +675,45 @@
         [Test]
         [ExpectedException(typeof(ArgumentNullException))]
         public void GroupJoin_InnerArgOuterKeySelectorArgInnerKeySelectorArgResultSelectorArg_PassNullAsInner_ThrowsArgumentNullException() {
-            var persons = new OnceEnumerable<Person>( new Person[]
+            var persons = new OnceEnumerable<Person>( new[]
                                  {
-                                     new Person() {FamilyName = "Müller", FirstName = "Peter", Age = 21},
-                                     new Person() {FamilyName = "müller", FirstName = "Herbert", Age = 22},
-                                     new Person() {FamilyName = "Meier", FirstName = "Hubert", Age= 23},
-                                     new Person() {FamilyName = "meier", FirstName = "Isidor", Age = 24}
+                                     new Person {FamilyName = "Müller", FirstName = "Peter", Age = 21},
+                                     new Person {FamilyName = "müller", FirstName = "Herbert", Age = 22},
+                                     new Person {FamilyName = "Meier", FirstName = "Hubert", Age= 23},
+                                     new Person {FamilyName = "meier", FirstName = "Isidor", Age = 24}
                                  });

-            var pets = new OnceEnumerable<Pet>( new Pet[]
+            var pets = new OnceEnumerable<Pet>( new[]
                            {
-                               new Pet() {Name = "Barley", Owner = "Peter"},
-                               new Pet() {Name = "Boots", Owner = "Herbert"},
-                               new Pet() {Name = "Whiskers", Owner = "Herbert"},
-                               new Pet() {Name = "Daisy", Owner = "Isidor"}
+                               new Pet {Name = "Barley", Owner = "Peter"},
+                               new Pet {Name = "Boots", Owner = "Herbert"},
+                               new Pet {Name = "Whiskers", Owner = "Herbert"},
+                               new Pet {Name = "Daisy", Owner = "Isidor"}
                            });

             persons.GroupJoin(pets, null, pet => pet.Owner,
                               (person, petCollection) =>
                               new { OwnerName = person.FirstName, Pets = petCollection.Select(pet => pet.Name) });
-
         }

         [Test]
         [ExpectedException(typeof(ArgumentNullException))]
         public void Intersect_SecondArg_PassNullAsArgument_ThrowsArgumentNullException() {
-            var source = new OnceEnumerable<int>( new int[] {1, 2, 3});
+            var source = new OnceEnumerable<int>( new[] {1, 2, 3});
             source.Intersect(null);
         }

         [Test]
         public void Intersect_SecondArg_ValidArguments_ReturnsIntersection() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3});
-            var argument =new OnceEnumerable<int>(new int[] {2, 3, 4});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3});
+            var argument =new OnceEnumerable<int>(new[] {2, 3, 4});
             source.Intersect(argument).Compare(2, 3);
         }

         [Test]
         public void Intersect_SecondArgComparerArg_ValidArguments_EqualityComparerIsUsed() {
-            var enumerable = new OnceEnumerable<string>(new string[] {"Heinrich", "Hubert", "Thomas"});
-            var argument = new OnceEnumerable<string>(new string[] {"Heinrich", "hubert", "Joseph"});
+            var enumerable = new OnceEnumerable<string>(new[] {"Heinrich", "Hubert", "Thomas"});
+            var argument = new OnceEnumerable<string>(new[] {"Heinrich", "hubert", "Joseph"});
             var result = enumerable.Intersect(argument, StringComparer.CurrentCultureIgnoreCase);
             result.Compare("Heinrich", "Hubert");
         }
@@ -729,12 +728,12 @@
         [Test]
         public void Join_InnerArgOuterKeySelectorArgInnerKeySelectorArgResultSelectorArg_ValidArguments_CorrectResult() {
             var persons = new OnceEnumerable<Person>(Person.CreatePersons());
-            var pets = new OnceEnumerable<Pet>( new Pet[]
+            var pets = new OnceEnumerable<Pet>( new[]
                            {
-                               new Pet() {Name = "Barley", Owner = "Peter"},
-                               new Pet() {Name = "Boots", Owner = "Herbert"},
-                               new Pet() {Name = "Whiskers", Owner = "Herbert"},
-                               new Pet() {Name = "Daisy", Owner = "Isidor"}
+                               new Pet {Name = "Barley", Owner = "Peter"},
+                               new Pet {Name = "Boots", Owner = "Herbert"},
+                               new Pet {Name = "Whiskers", Owner = "Herbert"},
+                               new Pet {Name = "Daisy", Owner = "Isidor"}
                            });
             var result = persons.Join(pets, aPerson => aPerson.FirstName, aPet => aPet.Owner,
                          (aPerson, aPet) => new {Owner = aPerson.FirstName, Pet = aPet.Name});
@@ -762,12 +761,12 @@
         [Test]
         public void Join_InnerArgOuterKeySelectorArgInnerKeySelectorArgResultSelectorArgComparerArg_ValidArguments_CorrectResult() {
             var persons = new OnceEnumerable<Person>(Person.CreatePersons());
-            var pets = new OnceEnumerable<Pet>(new Pet[]
+            var pets = new OnceEnumerable<Pet>(new[]
                            {
-                               new Pet() {Name = "Barley", Owner = "Peter"},
-                               new Pet() {Name = "Boots", Owner = "Herbert"},
-                               new Pet() {Name = "Whiskers", Owner = "herbert"},
-                               new Pet() {Name = "Daisy", Owner = "Isidor"}
+                               new Pet {Name = "Barley", Owner = "Peter"},
+                               new Pet {Name = "Boots", Owner = "Herbert"},
+                               new Pet {Name = "Whiskers", Owner = "herbert"},
+                               new Pet {Name = "Daisy", Owner = "Isidor"}
                            });
             var result = persons.Join(pets, aPerson => aPerson.FirstName, aPet => aPet.Owner,
                          (aPerson, aPet) => new { Owner = aPerson.FirstName, Pet = aPet.Name },
@@ -799,27 +798,27 @@

         [Test]
         public void Last_ListOfInts_LastElementIsReturned() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3});
             Assert.That(source.Last(), Is.EqualTo(3));
         }

         [Test]
         [ExpectedException(typeof(ArgumentNullException))]
         public void Last_PredicateArg_NullAsPredicate_ThrowsArgumentNullException() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3});
             source.Last(null);
         }

         [Test]
         [ExpectedException(typeof(InvalidOperationException))]
         public void Last_PredicateArg_NoMatchingElement_ThrowsInvalidOperationException() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4, 5});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4, 5});
             source.Last(i => i > 10);
         }

         [Test]
         public void Last_PredicateArg_ListOfInts_LastMatchingElementIsReturned() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4, 5});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4, 5});
             Assert.That(source.Last(i => i%2 == 0), Is.EqualTo(4));
         }

@@ -831,38 +830,38 @@

         [Test]
         public void LastOrDefault_NonEmptyList_LastElementIsReturned() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4, 5});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4, 5});
             Assert.That(source.LastOrDefault(), Is.EqualTo(5));
         }

         [Test]
         public void LastOrDefault_PredicateArg_ValidArguments_LastMatchingElementIsReturned() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4, 5});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4, 5});
             Assert.That(source.LastOrDefault(i => i%2 == 0), Is.EqualTo(4));
         }

         [Test]
         public void LastOrDefault_PredicateArg_NoMatchingElement_0IsReturned() {
-            var source = new OnceEnumerable<int>(new int[] {1, 3, 5, 7});
+            var source = new OnceEnumerable<int>(new[] {1, 3, 5, 7});
             Assert.That(source.LastOrDefault(i => i%2 == 0), Is.EqualTo(0));
         }

         [Test]
         public void LongCount_ValidArgument_ReturnsCorrectNumberOfElements() {
-            var source = new OnceEnumerable<int>(new int[] {1, 4, 7, 10});
+            var source = new OnceEnumerable<int>(new[] {1, 4, 7, 10});
             Assert.That(source.LongCount(), Is.EqualTo(4));
         }

         [Test]
         [ExpectedException(typeof(ArgumentNullException))]
         public void LongCount_PredicateArg_NullAsPredicate_ThrowsArgumentNullException() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4});
             source.LongCount(null);
         }

         [Test]
         public void LongCount_PredicateArg_ValidArguments_ReturnsCorrectNumerOfMatchingElements() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4, 5});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4, 5});
             Assert.That(source.LongCount(i => i%2 == 0), Is.EqualTo(2));
         }

@@ -871,12 +870,12 @@
         public void Max_EmptyList_ThrowsInvalidOperationException()
         {
             var source = new OnceEnumerable<int>(new int[0]);
-            var result = source.Max();
+            source.Max();
         }

         [Test]
         public void Max_ListOfInts_MaxValueIsReturned() {
-            var source = new OnceEnumerable<int>(new int[] {1000, 203, -9999});
+            var source = new OnceEnumerable<int>(new[] {1000, 203, -9999});
             Assert.That(source.Max(), Is.EqualTo(1000));
         }

@@ -918,7 +917,7 @@
         public void Min_Selector_ValidArguments_MinimumNonNullValueIsReturned()
         {
             var persons = new OnceEnumerable<Person>(Person.CreatePersons());
-            Assert.That(persons.Min<Person, int?>((Person p) => {
+            Assert.That(persons.Min<Person, int?>(p => {
                                         if (p.Age == 21) return null; // to test behavior if null belongs to result of transformation
                                         else return (p.Age);
                                     }), Is.EqualTo(22));
@@ -934,7 +933,7 @@
         [Test]
         [ExpectedException(typeof(ArgumentNullException))]
         public void OrderBy_KeySelectorArg_NullAsKeySelector_ThrowsArgumentNullException() {
-            var source = new OnceEnumerable<int>(new int[] {1, 4, 2});
+            var source = new OnceEnumerable<int>(new[] {1, 4, 2});
             source.OrderBy<int, int>(null);
         }

@@ -972,7 +971,7 @@
         [Test]
         public void OrderBy_KeySelectorArgComparerArg_ValidArguments_CorrectOutput() {
             var persons = new OnceEnumerable<Person>(Person.CreatePersons());
-            var result = persons.OrderBy<Person, int>(p => p.Age, new ReverseComparer());
+            var result = persons.OrderBy(p => p.Age, new ReverseComparer());
             var age = 25;
             foreach (var person in result) {
                 age--;
@@ -997,7 +996,7 @@
         [Test]
         [ExpectedException(typeof(ArgumentOutOfRangeException))]
         public void Range_ProduceRangeThatLeadsToOverflow_ThrowsArgumentOutOfRangeException() {
-            var result = Enumerable.Range(int.MaxValue - 3, 5);
+            Enumerable.Range(int.MaxValue - 3, 5);
         }

         [Test]
@@ -1009,7 +1008,7 @@
         [Test]
         [ExpectedException(typeof(ArgumentOutOfRangeException))]
         public void Repeat_PassNegativeCount_ThrowsArgumentOutOfRangeException() {
-            var result = Enumerable.Repeat("Hello World", -2);
+            Enumerable.Repeat("Hello World", -2);
         }

         [Test]
@@ -1020,7 +1019,7 @@

         [Test]
         public void Reverse_ValidArguments_CorrectResult() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4, 5});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4, 5});
             source.Reverse().Compare(5, 4, 3, 2, 1);
         }

@@ -1033,7 +1032,7 @@
         [Test]
         public void Select_SelectorArg_ValidArguments_CorrectResult() {
             var source = new OnceEnumerable<int>(new int[] {0, 1, 2, 3});
-            source.Select((int i, int index) => { return i*index; }).Compare(0, 1, 4, 9);
+            source.Select((i, index) => { return i*index; }).Compare(0, 1, 4, 9);
         }

         [Test]
@@ -1055,7 +1054,7 @@

         [Test]
         public void SelectMany_Selector3Arg_ValidArguments_CorrectOutput() {
-            var petOwners = new OnceEnumerable<PetOwner>( new PetOwner[]
+            var petOwners = new OnceEnumerable<PetOwner>( new[]
                 { new PetOwner { Name="Higa, Sidney",
                       Pets = new List<string>{ "Scruffy", "Sam" } },
                   new PetOwner { Name="Ashkenazi, Ronen",
@@ -1072,7 +1071,7 @@

         [Test]
         public void SelectMany_CollectionSelectorArgResultSelectorArg_ValidArguments_CorrectOutput() {
-            var petOwners = new OnceEnumerable<PetOwner>( new PetOwner[]
+            var petOwners = new OnceEnumerable<PetOwner>( new[]
                 { new PetOwner { Name="Higa",
                       Pets = new List<string>{ "Scruffy", "Sam" } },
                   new PetOwner { Name="Ashkenazi",
@@ -1094,21 +1093,21 @@
         [Test]
         [ExpectedException(typeof(ArgumentNullException))]
         public void SequenceEqual_SecondArg_NullAsArgument_ThrowsArgumentNullException() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3});
             source.SequenceEqual(null);
         }

         [Test]
         public void SequenceEqual_SecondArg_EqualArgument_ResultIsTrue() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3});
-            var argument = new OnceEnumerable<int>(new int[] {1, 2, 3});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3});
+            var argument = new OnceEnumerable<int>(new[] {1, 2, 3});
             Assert.That(source.SequenceEqual(argument), Is.True);
         }

         [Test]
         public void SequenceEqual_SecondArg_DifferentArgument_ResultIsFalse() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3});
-            var argument = new OnceEnumerable<int>(new int[] {1, 2, 3, 4});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3});
+            var argument = new OnceEnumerable<int>(new[] {1, 2, 3, 4});
             Assert.That(source.SequenceEqual(argument), Is.False);
         }

@@ -1123,9 +1122,9 @@

         [Test]
         public void SequenceEqual_SecondArgComparerArg_ValidArguments_ComparerIsUsed() {
-            var source = new OnceEnumerable<float>(new float[] {1f, 2f, 3f});
-            var argument = new OnceEnumerable<float>(new float[] {1.03f, 1.99f, 3.02f});
-            Assert.That(source.SequenceEqual<float>(argument, new FloatComparer()), Is.True);
+            var source = new OnceEnumerable<float>(new[] {1f, 2f, 3f});
+            var argument = new OnceEnumerable<float>(new[] {1.03f, 1.99f, 3.02f});
+            Assert.That(source.SequenceEqual(argument, new FloatComparer()), Is.True);
         }

         [Test]
@@ -1138,34 +1137,34 @@
         [Test]
         [ExpectedException(typeof(InvalidOperationException))]
         public void Single_SourceWithMoreThanOneElement_ThrowsInvalidOperationException() {
-            var source = new int[] {3, 6};
+            var source = new[] {3, 6};
             source.Single();
         }

         [Test]
         public void Single_SourceWithOneElement_SingleElementIsReturned() {
-            var source = new int[] {1};
+            var source = new[] {1};
             Assert.That(source.Single(), Is.EqualTo(1));
         }

         [Test]
         [ExpectedException(typeof(ArgumentNullException))]
         public void Single_PredicateArg_PassNullAsPredicate_ThrowsArgumentNullException() {
-            var source = new int[] {1, 2, 3};
+            var source = new[] {1, 2, 3};
             source.Single(null);
         }

         [Test]
         [ExpectedException(typeof(InvalidOperationException))]
         public void Single_PredicateArg_NoElementSatisfiesCondition_ThrowsInvalidOperationException() {
-            var source = new int[] {1, 3, 5};
+            var source = new[] {1, 3, 5};
             source.Single(i => i%2 == 0);
         }

         [Test]
         [ExpectedException(typeof(InvalidOperationException))]
         public void Single_PredicateArg_MoreThanOneElementSatisfiedCondition_ThrowsInvalidOperationException() {
-            var source = new int[] {1, 2, 3, 4};
+            var source = new[] {1, 2, 3, 4};
             source.Single(i => i%2 == 0);
         }

@@ -1178,14 +1177,14 @@

         [Test]
         public void Single_PredicateArg_ValidArguments_CorrectResult() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3});
             Assert.That(source.Single(i => i % 2 == 0), Is.EqualTo(2));
         }

         [Test]
         [ExpectedException(typeof(InvalidOperationException))]
         public void SingleOrDefault_MoreThanOneElementInSource_ThrowsInvalidOperationException() {
-            var source = new int[] {1, 2, 3};
+            var source = new[] {1, 2, 3};
             source.SingleOrDefault();
         }

@@ -1197,14 +1196,14 @@

         [Test]
         public void SingleOrDefault_SourceWithOneElement_SingleElementIsReturned() {
-            var source = new int[] {5};
+            var source = new[] {5};
             Assert.That(source.SingleOrDefault(), Is.EqualTo(5));
         }

         [Test]
         [ExpectedException(typeof(ArgumentNullException))]
         public void SingleOrDefault_PredicateArg_PassNullAsPredicate_ThrowsArgumentNullException() {
-            var source = new int[] {4};
+            var source = new[] {4};
             source.SingleOrDefault(null);
         }

@@ -1217,77 +1216,77 @@
         [Test]
         [ExpectedException(typeof(InvalidOperationException))]
         public void SingleOrDefault_PredicateArg_MoreThanOneElementSatisfiesCondition_ThrowsInvalidOperationException() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4, 5});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4, 5});
             source.SingleOrDefault(i => i%2 == 0);
         }

         [Test]
         public void SingleOrDefault_PredicateArg_NoElementSatisfiesCondition_ZeroIsReturned() {
-            var source = new OnceEnumerable<int>(new int[] {1, 3, 5});
+            var source = new OnceEnumerable<int>(new[] {1, 3, 5});
             Assert.That(source.SingleOrDefault(i => i % 2 == 0), Is.EqualTo(0));
         }

         [Test]
         public void SingleOrDefault_PredicateArg_OneElementSatisfiesCondition_CorrectElementIsReturned() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3});
             Assert.That(source.SingleOrDefault(i => i%2 == 0), Is.EqualTo(2));
         }

         [Test]
         public void Skip_ValidArguments_CorrectOutput() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
             source.Skip(5).Compare(6, 7, 8, 9, 10);
         }

         [Test]
         public void Skip_PassNegativeValueAsCount_SameBehaviorAsMicrosoftImplementation() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4, 5});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4, 5});
             source.Skip(-5).Compare(1, 2, 3, 4, 5);
         }

         [Test]
         [ExpectedException(typeof(ArgumentNullException))]
         public void SkipWhile_PredicateArg_PassNullAsPredicate_ThrowsArgumentNullException() {
-            var source = new int[] {1, 2, 3, 4, 5};
+            var source = new[] {1, 2, 3, 4, 5};
             Func<int, bool> predicate = null;
             source.SkipWhile(predicate);
         }

         [Test]
         public void SkipWhile_PredicateArg_ValidArguments_CorrectResult() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4, 5});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4, 5});
             source.SkipWhile(i => i < 3).Compare(3, 4, 5);
         }

         [Test]
         public void SkipWhile_PredicateArg_OtherValidArguments_CorrectResult() {
-            var source = new OnceEnumerable<int>(new int[] { 1, 2, 3, 4, 5, 1, 2, 3});
+            var source = new OnceEnumerable<int>(new[] { 1, 2, 3, 4, 5, 1, 2, 3});
             source.SkipWhile(i => i < 3).Compare(3, 4, 5, 1, 2, 3);
         }

         [Test]
         public void SkipWhile_PredicateArg_PredicateAlwaysTrue_EmptyResult() {
-            var source = new OnceEnumerable<int>(new int[] { 1, 2, 3 });
+            var source = new OnceEnumerable<int>(new[] { 1, 2, 3 });
             var result = source.SkipWhile(i => true);
             Assert.That(result.GetEnumerator().MoveNext(), Is.False);
         }

         [Test]
         public void SkipWhile_Predicate3Arg_ValidArguments_CorrectResult() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4, 5, 6, 7, 8, 9});
             source.SkipWhile((i, index) => index < 5).Compare(6, 7, 8, 9);
         }

         [Test]
         [ExpectedException(typeof(OverflowException))]
         public void Sum_SumOfArgumentsCausesOverflow_ThrowsOverflowException() {
-            var source = new OnceEnumerable<int>(new int[] {int.MaxValue - 1, 2});
+            var source = new OnceEnumerable<int>(new[] {int.MaxValue - 1, 2});
             source.Sum();
         }

         [Test]
         public void Sum_ValidArguments_CorrectResult() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
             Assert.That(source.Sum(), Is.EqualTo(55));
         }

@@ -1299,39 +1298,39 @@

         [Test]
         public void Sum_SelectorArg_ValidArguments_CorrectResult() {
-            var source = new OnceEnumerable<string>(new string[] {"dog", "cat", "eagle"});
+            var source = new OnceEnumerable<string>(new[] {"dog", "cat", "eagle"});
             Assert.That(source.Sum(s => s.Length), Is.EqualTo(11));
         }

         [Test]
         public void Take_ValidArguments_CorrectResult() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4, 5, 6});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4, 5, 6});
             source.Take(3).Compare(1, 2, 3);
         }

         [Test]
         public void Take_CountBiggerThanList_ReturnsAllElements() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4, 5});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4, 5});
             source.Take(10).Compare(1, 2, 3, 4, 5);
         }

         [Test]
         [ExpectedException(typeof(ArgumentNullException))]
         public void TakeWhile_PassNullAsPredicate_ThrowsArgumentNullException() {
-            var source = new int[] {1, 2, 3, 4, 5};
+            var source = new[] {1, 2, 3, 4, 5};
             Func<int, bool> func = null;
             source.TakeWhile(func);
         }

         [Test]
         public void TakeWhile_ValidArguments_CorrectResult() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
             source.TakeWhile(i => i*i < 50).Compare(1, 2, 3, 4, 5, 6, 7);
         }

         [Test]
         public void ToArray_ValidArguments_CorrectResult() {
-            var source = new OnceEnumerable<int>(new List<int>() {1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
+            var source = new OnceEnumerable<int>(new List<int> {1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
             var result = source.ToArray();
             Assert.That(result, Is.TypeOf(typeof (int[])));
             result.Compare(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
@@ -1340,20 +1339,20 @@
         [Test]
         [ExpectedException(typeof(ArgumentNullException))]
         public void ToDictionary_KeySelectorArg_KeySelectorProducesNullKey_ThrowsArgumentNullException() {
-            var source = new string[] {"eagle", "deer"};
+            var source = new[] {"eagle", "deer"};
             source.ToDictionary<string, string>(s => null);
         }

         [Test]
         [ExpectedException(typeof(ArgumentException))]
         public void ToDictionary_KeySelectorArg_DuplicateKeys_ThrowsArgumentException() {
-            var source = new string[] {"eagle", "deer", "cat", "dog"};
+            var source = new[] {"eagle", "deer", "cat", "dog"};
             source.ToDictionary(s => s.Length);
         }

         [Test]
         public void ToDictionary_KeySelectorArg_ValidArguments_CorrectResult() {
-            var source = new OnceEnumerable<string>(new string[] {"1", "2", "3"});
+            var source = new OnceEnumerable<string>(new[] {"1", "2", "3"});
             var result = source.ToDictionary(s => int.Parse(s));
             int check = 1;
             foreach (var pair in result) {
@@ -1366,7 +1365,7 @@

         [Test]
         public void ToDictionary_KeySelectorArgElementSelectorArg_ValidArguments_CorrectResult() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
             var result = source.ToDictionary(i => i.ToString(), i => Math.Sqrt(double.Parse(i.ToString())));
             int check = 1;
             foreach (var pair in result) {
@@ -1378,7 +1377,7 @@

         [Test]
         public void ToList_ValidArguments_CorrectResult() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
             var result = source.ToList();
             Assert.That(result, Is.TypeOf(typeof(List<int>)));
             result.Compare(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
@@ -1386,7 +1385,7 @@

         [Test]
         public void ToLookup_KeySelectorArg_ValidArguments_CorrectResult() {
-            var source = new OnceEnumerable<string>(new string[] {"eagle", "dog", "cat", "bird", "camel"});
+            var source = new OnceEnumerable<string>(new[] {"eagle", "dog", "cat", "bird", "camel"});
             var result = source.ToLookup(s => s.Length);

             result[3].Compare("dog", "cat");
@@ -1396,7 +1395,7 @@

         [Test]
         public void ToLookup_KeySelectorArgElementSelectorArg_ValidArguments_CorrectResult() {
-            var source = new OnceEnumerable<string>(new string[] { "eagle", "dog", "cat", "bird", "camel" });
+            var source = new OnceEnumerable<string>(new[] { "eagle", "dog", "cat", "bird", "camel" });
             var result = source.ToLookup(s => s.Length, str => str.ToCharArray().Reverse());
             var enumerator = result[3].GetEnumerator();
             enumerator.MoveNext(); Assert.That(enumerator.Current.ToString(), Is.EqualTo("dog".ToCharArray().Reverse().ToString()));
@@ -1416,41 +1415,41 @@
         [Test]
         [ExpectedException(typeof(ArgumentNullException))]
         public void Union_SecondArg_PassNullAsArgument_ThrowsArgumentNullException() {
-            var source = new int[] {5, 3, 9, 7, 5, 9, 3, 7};
+            var source = new[] {5, 3, 9, 7, 5, 9, 3, 7};
             source.Union(null);
         }

         [Test]
         public void Union_SecondArg_ValidIntArguments_NoDuplicatesAndInSourceOrder() {
-            var source = new OnceEnumerable<int>(new int[] { 5, 3, 9, 7, 5, 9, 3, 7 });
-            var argument = new OnceEnumerable<int>(new int[] {8, 3, 6, 4, 4, 9, 1, 0});
+            var source = new OnceEnumerable<int>(new[] { 5, 3, 9, 7, 5, 9, 3, 7 });
+            var argument = new OnceEnumerable<int>(new[] {8, 3, 6, 4, 4, 9, 1, 0});
             source.Union(argument).Compare(5, 3, 9, 7, 8, 6, 4, 1, 0);
         }

         [Test]
         public void Union_SecondArgComparerArg_UpperCaseAndLowerCaseStrings_PassedComparerIsUsed() {
-            var source = new OnceEnumerable<string>(new string[] {"A", "B", "C", "D", "E", "F"});
-            var argument = new OnceEnumerable<string>(new string[] {"a", "b", "c", "d", "e", "f"});
+            var source = new OnceEnumerable<string>(new[] {"A", "B", "C", "D", "E", "F"});
+            var argument = new OnceEnumerable<string>(new[] {"a", "b", "c", "d", "e", "f"});
             source.Union(argument, StringComparer.CurrentCultureIgnoreCase).Compare("A", "B", "C", "D", "E", "F");
         }

         [Test]
         [ExpectedException(typeof(ArgumentNullException))]
         public void Where_PredicateArg_PassNullAsPredicate_ThrowsArgumentNullException() {
-            var source = new int[] {1, 2, 3, 4};
+            var source = new[] {1, 2, 3, 4};
             Func<int, bool> func = null;
             source.Where(func);
         }

         [Test]
         public void Where_PredicateArg_Integers_YieldsEvenIntegers() {
-            var source = new OnceEnumerable<int>(new int[] {1, 2, 3, 4, 5});
+            var source = new OnceEnumerable<int>(new[] {1, 2, 3, 4, 5});
             source.Where(i => i%2 == 0).Compare(2, 4);
         }

         [Test]
         public void Where_Predicate3Arg_Strings_YieldsElementsWithEvenIndex() {
-            var source = new OnceEnumerable<string>(new string[] {"Camel", "Marlboro", "Parisienne", "Lucky Strike"});
+            var source = new OnceEnumerable<string>(new[] {"Camel", "Marlboro", "Parisienne", "Lucky Strike"});
             source.Where((s, i) => i%2 == 0).Compare("Camel", "Parisienne");
         }

@@ -1464,7 +1463,7 @@

             /// Returns true if there are no more elements in the collection.
             public void AssertEnded() {
-                NUnit.Framework.Assert.That(e.MoveNext(), Is.False, "Too many elements in source.");
+                Assert.That(e.MoveNext(), Is.False, "Too many elements in source.");
             }

             /// <returns>Next element in collection.</returns>
@@ -1479,7 +1478,7 @@
             /// <returns>Itself</returns>
             public Reader<T> Next(Constraint constraint) {
                 Debug.Assert(constraint != null);
-                NUnit.Framework.Assert.That(Read(), constraint);
+                Assert.That(Read(), constraint);
                 return this;
             }

@@ -1506,14 +1505,14 @@

         [Test]
         public void EnsureTest() {
-            var enumerable = new int[] {1, 2, 3};
+            var enumerable = new[] {1, 2, 3};
             Reader<int> rd = new Reader<int>(enumerable);
             rd.Ensure(Is.EqualTo(1), Is.EqualTo(2), Is.EqualTo(3));
         }

         [Test]
         public void CompareTest() {
-            var enumerable = new int[] {1, 2, 3};
+            var enumerable = new[] {1, 2, 3};
             var reader = new Reader<int>(enumerable);
             reader.Compare(1, 2, 3);
         }


Re-aligned highlights for Mono that were misaligned after recent changes.

--- test/BackLINQ.Tests/EnumerableFixture.cs
+++ test/BackLINQ.Tests/EnumerableFixture.cs
@@ -113,7 +113,7 @@
         [ExpectedException(typeof(InvalidCastException))]
         public void Cast_InvalidSource_ThrowsInvalidCastException()
         {
-            // .................................V----V Needed for Mono (CS0029)
+            // ...................V----V Needed for Mono (CS0029)
             var source = Read(new object[] { 1000, "hello", new object() });
             var target = source.Cast<byte>();
             // do something with the results so Cast will really be executed (deferred execution)
@@ -1014,7 +1014,7 @@
         [Test]
         public void OfType_EnumerableWithElementsOfDifferentTypes_OnlyDecimalsAreReturned()
         {
-            // .................................V----V Needed for Mono (CS0029)
+            // ...................V----V Needed for Mono (CS0029)
             var source = Read(new object[] { 1, "Hello", 1.234m, new object() });
             var result = source.OfType<decimal>();
             result.Compare(1.234m);