public void ExpressionTests_ContainsGuid()
        {
            //Arrange
            var userList = User.GenerateSampleModels(5, false);
            var userQry = userList.AsQueryable();

            var failValues = new List<Guid>() { 
                new Guid("{22222222-7651-4045-962A-3D44DEE71398}"), 
                new Guid("{33333333-8F80-4497-9125-C96DEE23037D}"), 
                new Guid("{44444444-E32D-4DE1-8F1C-A144C2B0424D}") 
            };
            var successValues = failValues.Concat(new[] { userList[0].Id }).ToArray();


            //Act
            var found1 = userQry.Where("Id in @0", successValues);
            var found2 = userQry.Where("@0.Contains(Id)", successValues);
            var notFound1 = userQry.Where("Id in @0", failValues);
            var notFound2 = userQry.Where("@0.Contains(Id)", failValues);

            //Assert
#if NET35
            Assert.AreEqual(userList[0].Id, ((User)found1.Single()).Id);
            Assert.AreEqual(userList[0].Id, ((User)found2.Single()).Id);
#else
            Assert.AreEqual(userList[0].Id, found1.Single().Id);
            Assert.AreEqual(userList[0].Id, found2.Single().Id);
#endif
            Assert.IsFalse(notFound1.Any());
            Assert.IsFalse(notFound2.Any());
        }
        public void Read_Event_From_2_Computer_Log_With_WMI()
        {
            // more info http://msdn.microsoft.com/en-us/library/ms257337(v=VS.80).aspx
            //Arrange
            Debug.WriteLine("Testing Wmi Method Write_And_Read_Event_From_2_Log_With_WMI(), scary.");
            DateTime FromTime = DateTime.Now.AddDays(-1);

            //     ManagementScope scope =
            //    new ManagementScope(
            //        "\\\\WL2006228\\root\\cimv2");
            //scope.Connect();
            // string SomeDateTime = "20130526000000.000000+000";
            string strFromTime = String.Format(Global_Const.DATE_FORMAT_STR, FromTime) + ".000000+000";
            string wmiQuery =
                String.Format("SELECT * FROM Win32_NTLogEvent WHERE Logfile = '{0}' AND TimeGenerated > '{1}'",
                              Global_Const.SOURCE, strFromTime);
            //Act
            var mos = new ManagementObjectSearcher("\\\\.\\root\\cimv2", wmiQuery);
            //Act
            var ComputerName = System.Environment.MachineName;
            var mos2 = new ManagementObjectSearcher("\\\\" + ComputerName + "\\root\\cimv2", wmiQuery);

            object o;
            Debug.WriteLine("***** Start writing Properties *****");
            var EventRecordList = new List<EventRecord>();
            var EventRecordList2 = new List<EventRecord>();

            foreach (ManagementObject mo in mos.Get())
            {
                EventRecordList.Add(new EventRecord(mo));
                Debug.WriteLine("***** New Managment Object from Eventstore *****");
                Debug.WriteLine(String.Format("{0}: {1}", "Message", EventRecordList[EventRecordList.Count - 1].Message));
            }

            foreach (ManagementObject mo2 in mos2.Get())
            {
                EventRecordList2.Add(new EventRecord(mo2));
                Debug.WriteLine("***** New Managment Object from Eventstore *****");
                Debug.WriteLine(String.Format("{0}: {1}", "Message", EventRecordList[EventRecordList.Count - 1].Message));
            }

            var eventRecMergedList = EventRecordList.Concat(EventRecordList2).OrderBy(e => e.TimeGenerated);
            DateTime prevEv = DateTime.UtcNow;
            bool isBigger = false;
            foreach (EventRecord ev in eventRecMergedList)
            {
                Debug.WriteLine(ev.TimeGenerated);
                Debug.WriteLine(ev.RecordNumber);
                isBigger = (ev.TimeGenerated != prevEv);
                prevEv = ev.TimeGenerated;
                if (isBigger )
                {
                    break;
                }
            }

            //Assert
            Assert.IsTrue(eventRecMergedList.Any(), "There should be some events last day");
            Assert.IsTrue(isBigger, "Sorting sucks");
        }
Example #3
0
        static DatamodelTests()
        {
            var binary = new byte[16];
            new Random().NextBytes(binary);
            var quat = Quaternion.Normalize(new Quaternion(1, 2, 3, 4)); // dmxconvert will normalise this if I don't!

            TestValues_V1 = new List<object>(new object[] { "hello_world", 1, 1.5f, true, binary, null, System.Drawing.Color.Blue,
                new Vector2(1,2), new Vector3(1,2,3), new Vector4(1,2,3,4), quat, new Matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) });

            TestValues_V2 = TestValues_V1.ToList();
            TestValues_V2[5] = TimeSpan.FromMinutes(5) + TimeSpan.FromTicks(TimeSpan.TicksPerMillisecond / 2);

            TestValues_V3 = TestValues_V1.Concat(new object[] { (byte)0xFF, (UInt64)0xFFFFFFFF }).ToList();
        }
        public void Write_Test()
        {
            // Arrange

            var orderedOperations = new AbstractRepositoryOperation[1];
            var primaryKeyOperations = new List<InsertRecord>();
            var currentOrder = new Counter();
            var regularColumns = new List<Column>();
            var foreignKeyColumns = new List<ExtendedColumnSymbol>();
            var columnList = regularColumns.Concat(Helpers.ColumnSymbolToColumn(foreignKeyColumns));
            string tableName = typeof (SubjectClass).Name;

            this.serviceMock.Setup(m => m.GetPrimaryKeyOperations(this.peers)).Returns(primaryKeyOperations);
            this.serviceMock.Setup(m => m.GetRegularColumns(this.writePrimitivesMock.Object)).Returns(regularColumns);
            this.serviceMock.Setup(m => m.GetForeignKeyColumns(primaryKeyOperations)).Returns(foreignKeyColumns);

            // Act

            this.insertRecord.Write(this.breakerMock.Object, this.writePrimitivesMock.Object, currentOrder, orderedOperations);

            // Assert

            this.breakerMock.Verify(m => m.Push<IWritePrimitives, Counter, AbstractRepositoryOperation[]>(this.insertRecord.Write), Times.Once);
            this.serviceMock.Verify(m => m.GetPrimaryKeyOperations(this.peers), Times.Once);
            this.serviceMock.Verify(
                m =>
                    m.WritePrimaryKeyOperations(this.writePrimitivesMock.Object, primaryKeyOperations,
                        this.breakerMock.Object, currentOrder, orderedOperations), Times.Once);

            this.serviceMock.Verify(m => m.GetRegularColumns(this.writePrimitivesMock.Object), Times.Once);
            this.serviceMock.Verify(m => m.GetForeignKeyColumns(primaryKeyOperations), Times.Once);

            Assert.AreEqual(this.insertRecord, orderedOperations[0]);

            this.serviceMock.Verify(
                m =>
                    m.WritePrimitives(this.writePrimitivesMock.Object, null, It.IsAny<string>(), tableName, columnList,
                        It.Is<List<ColumnSymbol>>(l => l.Count == 0)), Times.Once);

            this.serviceMock.Verify(m => m.CopyPrimaryToForeignKeyColumns(It.Is<IEnumerable<Column>>(c => !c.Any())), Times.Once());
        }
Example #5
0
        public virtual void HistoryMaximumLength() {
            using (var interactive = Prepare()) {
                const int historyMax = 50;

                var expected = new List<string>();
                for (int i = 0; i < historyMax + 1; i++) {
                    string cmd = "x = " + i;
                    expected.Add(">" + cmd);
                    interactive.Type(cmd);

                    interactive.WaitForText(expected.Concat(new[] { ">" }));
                }

                // add an extra item for the current input which we'll update as
                // we go through the history
                expected.Add(">");
                for (int i = 0; i < historyMax; i++) {
                    interactive.PreviousHistoryItem();

                    expected[expected.Count - 1] = expected[expected.Count - i - 2];
                    interactive.WaitForText(expected);
                }
                // end of history, one more up shouldn't do anything
                interactive.PreviousHistoryItem();
                interactive.WaitForText(expected);
            }
        }
        public void SynchronousTestQueueMessages()
        {
            int clientCount = 3;
            int serverCount = 2;

            QueueName requestQueueName = CreateRandomQueueName();
            QueueName[] responseQueueNames = Enumerable.Range(0, clientCount).Select(i => CreateRandomQueueName()).ToArray();

            IQueueingService provider = CreateProvider();

            Stopwatch initializationTimer = Stopwatch.StartNew();
            Console.WriteLine("Creating request queue...");
            provider.CreateQueue(requestQueueName);
            Console.WriteLine("Creating {0} response queues...", responseQueueNames.Length);
            foreach (QueueName queueName in responseQueueNames)
                provider.CreateQueue(queueName);
            TimeSpan initializationTime = initializationTimer.Elapsed;
            Console.WriteLine("Initialization time: {0} sec", initializationTime.TotalSeconds);

            TimeSpan testDuration = TimeSpan.FromSeconds(10);

            int[] clientResults = new int[clientCount];
            int[] serverResults = new int[serverCount];
            using (CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(testDuration))
            {
                Stopwatch processingTimer = Stopwatch.StartNew();

                List<Exception> errors = new List<Exception>();

                List<Thread> clientThreads = new List<Thread>();

                for (int i = 0; i < clientCount; i++)
                {
                    int clientIndex = i;
                    Thread client = new Thread(
                        () =>
                        {
                            try
                            {
                                PublishMessages(requestQueueName, responseQueueNames[clientIndex], ref clientResults[clientIndex], cancellationTokenSource.Token);
                            }
                            catch (Exception ex)
                            {
                                errors.Add(ex);
                            }
                        });
                    client.Start();
                    client.Name = "Client " + i;
                    clientThreads.Add(client);
                }

                List<Thread> serverThreads = new List<Thread>();
                for (int i = 0; i < serverCount; i++)
                {
                    int serverIndex = i;
                    Thread server = new Thread(
                        () =>
                        {
                            try
                            {
                                SubscribeMessages(requestQueueName, ref serverResults[serverIndex], cancellationTokenSource.Token);
                            }
                            catch (Exception ex)
                            {
                                errors.Add(ex);
                            }
                        });
                    server.Start();
                    server.Name = "Server " + i;
                    serverThreads.Add(server);
                }

                // wait for all client and server threads to finish processing
                foreach (Thread thread in clientThreads.Concat(serverThreads))
                    thread.Join();

                if (errors.Count > 0)
                    throw new AggregateException(errors);
            }

            int clientTotal = 0;
            int serverTotal = 0;
            for (int i = 0; i < clientResults.Length; i++)
            {
                Console.WriteLine("Client {0}: {1} messages", i, clientResults[i]);
                clientTotal += clientResults[i];
            }
            for (int i = 0; i < serverResults.Length; i++)
            {
                Console.WriteLine("Server {0}: {1} messages", i, serverResults[i]);
                serverTotal += serverResults[i];
            }

            double clientRate = clientTotal / testDuration.TotalSeconds;
            double serverRate = serverTotal / testDuration.TotalSeconds;
            Console.WriteLine("Total client messages: {0} ({1} messages/sec, {2} messages/sec/client)", clientTotal, clientRate, clientRate / clientCount);
            Console.WriteLine("Total server messages: {0} ({1} messages/sec, {2} messages/sec/server)", serverTotal, serverRate, serverRate / serverCount);

            Console.WriteLine("Deleting request queue...");
            provider.DeleteQueue(requestQueueName);
            Console.WriteLine("Deleting {0} response queues...", responseQueueNames.Length);
            foreach (QueueName queueName in responseQueueNames)
                provider.DeleteQueue(queueName);

            if (clientTotal == 0)
                Assert.Inconclusive("No messages were fully processed by the test.");
        }
Example #7
0
        protected override void DoTest()
        {
            string outDir = Path.Combine(TestContext.TestDir, "PerfPeakTest");
            string resultsTable = Path.Combine(outDir, "results.txt");
            Directory.CreateDirectory(outDir); // In case it doesn't already exists
            File.Delete(resultsTable); // In case it does already exist
            var none = new string[0];
            var openSwath = new List<string> { "OpenSwath.csv" };
            var spectronaut = new List<string> { "Spectronaut.csv" };
            var peakView = new List<string> { "PeakView.txt" };
            var peakViewSpectronaut = spectronaut.Concat(peakView).ToList();
            var peakViewOpenSwath = openSwath.Concat(peakView).ToList();
            var peakViewSpectronautOpenSwath = peakViewSpectronaut.Concat(openSwath).ToList();
            var decoysAndSecond = MODEL_NAMES;
            var secondOnly = MODEL_NAMES.Take(3).ToList();

            int i = 0;
            using (var fs = new FileSaver(resultsTable))
            using (var resultsWriter = new StreamWriter(fs.SafeName))
            {
                WriteHeader(resultsWriter);
                // Overlap 10 mz
                AnalyzeDirectory(i++, none, outDir, decoysAndSecond, resultsWriter);
                // Overlap 20 mz
                AnalyzeDirectory(i++, none, outDir, decoysAndSecond, resultsWriter);
                // Schilling Ack
                AnalyzeDirectory(i++, peakView, outDir, decoysAndSecond, resultsWriter, new List<int> { 1 });
                // Schilling Mito
                AnalyzeDirectory(i++, peakView, outDir, decoysAndSecond, resultsWriter, new List<int> { 1 });
                // Reiter sPRG
                AnalyzeDirectory(i++, spectronaut, outDir, decoysAndSecond, resultsWriter, new List<int> { 0 });
                // Ludwig sPRG
                AnalyzeDirectory(i++, none, outDir, decoysAndSecond, resultsWriter, new List<int> { 1 });
                // Hasmik Swath Heavy only
                AnalyzeDirectory(i++, peakViewSpectronautOpenSwath, outDir, decoysAndSecond, resultsWriter, new List<int> { 1, 1, 1 });
                // Hasmik Qe Heavy only
                AnalyzeDirectory(i++, spectronaut, outDir, decoysAndSecond, resultsWriter, new List<int> { 1 });
                // Hasmik SWATH
                AnalyzeDirectory(i++, peakViewSpectronautOpenSwath, outDir, decoysAndSecond, resultsWriter, new List<int> { 1, 1, 1 });
                // Hasmik QE
                AnalyzeDirectory(i++, spectronaut, outDir, decoysAndSecond, resultsWriter, new List<int> { 1 });
                // Hasmik Swath Light only
                AnalyzeDirectory(i++, peakViewSpectronaut, outDir, decoysAndSecond, resultsWriter, new List<int> { 0, 1 });
                // Hasmik Qe Light only
                AnalyzeDirectory(i++, spectronaut, outDir, decoysAndSecond, resultsWriter, new List<int> { 1 });
                // OpenSwath_Water
                AnalyzeDirectory(i++, peakViewOpenSwath, outDir, decoysAndSecond, resultsWriter, new List<int> { 2, 1 });
                // OpenSwath_Yeast
                AnalyzeDirectory(i++, peakViewOpenSwath, outDir, decoysAndSecond, resultsWriter, new List<int> { 1, 1 });
                // OpenSwath_Human
                AnalyzeDirectory(i++, peakViewOpenSwath, outDir, decoysAndSecond, resultsWriter, new List<int> { 2, 1 });
                // Olga SRM Course vantage
                AnalyzeDirectory(i++, none, outDir, decoysAndSecond, resultsWriter);
                // Olga SRM Course
                AnalyzeDirectory(i++, none, outDir, decoysAndSecond, resultsWriter);
                // Heart Failure
                AnalyzeDirectory(i++, none, outDir, secondOnly, resultsWriter);
                // Ovarian cancer
                AnalyzeDirectory(i++, none, outDir, secondOnly, resultsWriter);
                // mProphet Gold
                AnalyzeDirectory(i++, none, outDir, decoysAndSecond, resultsWriter);
                // MikeB high (DDA dilution top 12 runs)
                AnalyzeDirectory(i++, none, outDir, secondOnly, resultsWriter);
                // Schilling DDA (DDA dilution 15 runs)
                AnalyzeDirectory(i++, none, outDir, secondOnly, resultsWriter);
                // Held DIA
                AnalyzeDirectory(i++, peakView, outDir, decoysAndSecond, resultsWriter, new List<int> { 4 });
                resultsWriter.Close();
                fs.Commit();
            }

        }
        public void Concat_abnormal()
        {
            // arrange
            List<Object> list = new List<Object>();

            // act and assert
            try
            {
                list.Concat(null);
                Assert.Fail();
            }
            catch (Exception e)
            {
                Assert.IsTrue(e is ArgumentNullException);
            }
        }
Example #9
0
        public void SendBuffer_and_ReceiveBuffer_must_correctly_cooperate_with_each_other()
        {
            var msgCount = 1000;
            var deliveryProbability = 0.5D;
            var referenceList = Enumerable.Range(0, msgCount).Select(x => Msg(x)).ToList();

            var toSend = referenceList;
            var received = new List<Sequenced>();
            var sndBuf = new AckedSendBuffer<Sequenced>(10);
            var rcvBuf = new AckedReceiveBuffer<Sequenced>();
            var log = new List<string>();
            var lastAck = new Ack(new SeqNo(-1));

            Action<string> dbLog = log.Add;
            Action<int, double> senderSteps = (steps, p) =>
            {
                var resends = new List<Sequenced>(sndBuf.Nacked.Concat(sndBuf.NonAcked).Take(steps));

                var sends = new List<Sequenced>();
                if (steps - resends.Count > 0)
                {
                    var tmp = toSend.Take(steps - resends.Count).ToList();
                    toSend = toSend.Drop(steps - resends.Count).ToList();
                    sends = tmp;
                }

                foreach (var msg in resends.Concat(sends))
                {
                    if (sends.Contains(msg)) sndBuf = sndBuf.Buffer(msg);
                    if (Happened(p))
                    {
                        var del = rcvBuf.Receive(msg).ExtractDeliverable;
                        rcvBuf = del.Buffer;
                        dbLog(string.Format("{0} -- {1} --> {2}", sndBuf, msg, rcvBuf));
                        lastAck = del.Ack;
                        received.AddRange(del.Deliverables);
                        dbLog(string.Format("R: {0}", string.Join(",", received.Select(x => x.ToString()))));
                    }
                    else
                    {
                        dbLog(string.Format("{0} -- {1} --X {2}", sndBuf, msg, rcvBuf));
                    }
                }
            };

            Action<double> receiverStep = (p) =>
            {
                if (Happened(p))
                {
                    sndBuf = sndBuf.Acknowledge(lastAck);
                    dbLog(string.Format("{0} <-- {1} -- {2}", sndBuf, lastAck, rcvBuf));
                }
                else
                {
                    dbLog(string.Format("{0} X-- {1} -- {2}", sndBuf, lastAck, rcvBuf));
                }
            };

            //Dropping phase
            System.Diagnostics.Debug.WriteLine("Starting unreliable delivery for {0} messages, with delivery probaboly P = {1}", msgCount, deliveryProbability);
            var nextSteps = msgCount*2;
            while (nextSteps > 0)
            {
                var s = Geom(0.3, limit: 5);
                senderSteps(s, deliveryProbability);
                receiverStep(deliveryProbability);
                nextSteps--;
            }
            System.Diagnostics.Debug.WriteLine("Successfully delivered {0} messages from {1}", received.Count, msgCount);
            System.Diagnostics.Debug.WriteLine("Entering reliable phase");

            //Finalizing pahase
            for (var i = 1; i <= msgCount; i++)
            {
                senderSteps(1, 1.0);
                receiverStep(1.0);
            }

            if (!received.SequenceEqual(referenceList))
            {
                System.Diagnostics.Debug.WriteLine(string.Join(Environment.NewLine, log));
                System.Diagnostics.Debug.WriteLine("Received: ");
                System.Diagnostics.Debug.WriteLine(string.Join(Environment.NewLine, received.Select(x => x.ToString())));
                Assert.Fail("Not all messages were received");
            }

            System.Diagnostics.Debug.WriteLine("All messages have been successfully delivered");
        }
        public async Task TestQueueMessages()
        {
            int clientCount = 3;
            int serverCount = 2;

            QueueName requestQueueName = CreateRandomQueueName();
            QueueName[] responseQueueNames = Enumerable.Range(0, clientCount).Select(i => CreateRandomQueueName()).ToArray();

            IQueueingService provider = CreateProvider();
            CancellationTokenSource testCancellationTokenSource = new CancellationTokenSource(TestTimeout(TimeSpan.FromSeconds(300)));

            Stopwatch initializationTimer = Stopwatch.StartNew();
            Console.WriteLine("Creating request queue...");
            await provider.CreateQueueAsync(requestQueueName, testCancellationTokenSource.Token);
            Console.WriteLine("Creating {0} response queues...", responseQueueNames.Length);
            await Task.Factory.ContinueWhenAll(responseQueueNames.Select(queueName => (Task)provider.CreateQueueAsync(queueName, testCancellationTokenSource.Token)).ToArray(), TaskExtrasExtensions.PropagateExceptions);
            TimeSpan initializationTime = initializationTimer.Elapsed;
            Console.WriteLine("Initialization time: {0} sec", initializationTime.TotalSeconds);

            TimeSpan testDuration = TimeSpan.FromSeconds(10);
            CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(testDuration);

            Stopwatch processingTimer = Stopwatch.StartNew();

            List<Task<int>> clientTasks = new List<Task<int>>();
            List<Task<int>> serverTasks = new List<Task<int>>();
            for (int i = 0; i < clientCount; i++)
                clientTasks.Add(PublishMessages(requestQueueName, responseQueueNames[i], cancellationTokenSource.Token));
            for (int i = 0; i < serverCount; i++)
                serverTasks.Add(SubscribeMessages(requestQueueName, cancellationTokenSource.Token));

            // wait for all client and server tasks to finish processing
            await Task.Factory.ContinueWhenAll(clientTasks.Concat(serverTasks).Cast<Task>().ToArray(), TaskExtrasExtensions.PropagateExceptions);

            int clientTotal = 0;
            int serverTotal = 0;
            for (int i = 0; i < clientTasks.Count; i++)
            {
                Console.WriteLine("Client {0}: {1} messages", i, clientTasks[i].Result);
                clientTotal += clientTasks[i].Result;
            }
            for (int i = 0; i < serverTasks.Count; i++)
            {
                Console.WriteLine("Server {0}: {1} messages", i, serverTasks[i].Result);
                serverTotal += serverTasks[i].Result;
            }

            double clientRate = clientTotal / testDuration.TotalSeconds;
            double serverRate = serverTotal / testDuration.TotalSeconds;
            Console.WriteLine("Total client messages: {0} ({1} messages/sec, {2} messages/sec/client)", clientTotal, clientRate, clientRate / clientCount);
            Console.WriteLine("Total server messages: {0} ({1} messages/sec, {2} messages/sec/server)", serverTotal, serverRate, serverRate / serverCount);

            Console.WriteLine("Deleting request queue...");
            await provider.DeleteQueueAsync(requestQueueName, testCancellationTokenSource.Token);
            Console.WriteLine("Deleting {0} response queues...", responseQueueNames.Length);
            await Task.Factory.ContinueWhenAll(responseQueueNames.Select(queueName => provider.DeleteQueueAsync(queueName, testCancellationTokenSource.Token)).ToArray(), TaskExtrasExtensions.PropagateExceptions);

            if (clientTotal == 0)
                Assert.Inconclusive("No messages were fully processed by the test.");
        }
Example #11
0
        public void Concat()
        {
            // arrange
            List<int> list = new List<int>() { 1, 2, 3 };
            List<int> listSecond = new List<int>() { 4, 5, 6 };

            // act
            List<int> actual = list.Concat(listSecond).ToList();

            // assert
            Assert.AreEqual(6, actual.Count());
        }
 private string GenerateInputFile(int linesCount)
 {
     var lines = new List<string>();
     lines.Add("Admin1,Admin2,Admin3,Admin4,Population2010");
     File.WriteAllLines(
         inputFileLocation,
         lines.Concat(
             Enumerable.Range(1, linesCount)
                 .Select(x => "REG04B,MARINDUQUE ,BOAC,Agot,502")));
     return inputFileLocation;
 }
Example #13
0
        public void TestListConcat()
        {
            var x = new List<int> { 1, 2 }.ToLiveList();
            var y = new List<int> { 3, 4 }.ToLiveList();
            var i = x.Concat(y).ToIndependent();

            i.States().Take(1).Check(
                () => { },
                state =>
                {
                    var s = state.Single();
                    Assert.IsTrue(s.Status == StateStatus.Connecting);
                    Assert.IsTrue(s.Inner.SequenceEqual(new[] { 1, 2, 3, 4 }));
                    Assert.IsTrue(s.Delta == null);
                });

            i.States().Skip(1).Take(1).Check(
                () => x.PublishInner.Insert(0, 0),
                state =>
                {
                    var s = state.Single();
                    Assert.IsTrue(s.Status == StateStatus.Connected);
                    Assert.IsTrue(s.Delta.HasChange());
                    Assert.IsTrue(s.Inner.SequenceEqual(new[] { 0, 1, 2, 3, 4 }));
                    Assert.IsTrue(s.Delta.IndexDeltas.SequenceEqual(new[]
                        {
                            new IndexNode<int>
                            {
                                Index = 0,
                                DenseIndex = 0,
                                Data = new ListIndexDelta<int>
                                {
                                    InsertItems = new[] { 0 },
                                },
                            }
                        }, new IndexNodeComparer<int>()));
                });

            i.States().Skip(1).Take(1).Check(
                () => y.PublishInner.Insert(1, -1),
                state =>
                {
                    var s = state.Single();
                    Assert.IsTrue(s.Status == StateStatus.Connected);
                    Assert.IsTrue(s.Delta.HasChange());
                    Assert.IsTrue(s.Inner.SequenceEqual(new[] { 0, 1, 2, 3, -1, 4 }));
                    Assert.IsTrue(s.Delta.IndexDeltas.SequenceEqual(new[]
                        {
                            new IndexNode<int>
                            {
                                Index = 4,
                                DenseIndex = 0,
                                Data = new ListIndexDelta<int>
                                {
                                    InsertItems = new[] { -1 },
                                },
                            }
                        }, new IndexNodeComparer<int>()));
                });

            i.States().Skip(1).Take(1).Check(
                () => y.PublishInner.RemoveAt(1),
                state =>
                {
                    var s = state.Single();
                    Assert.IsTrue(s.Status == StateStatus.Connected);
                    Assert.IsTrue(s.Delta.HasChange());
                    Assert.IsTrue(s.Inner.SequenceEqual(new[] { 0, 1, 2, 3, 4 }));
                    Assert.IsTrue(s.Delta.IndexDeltas.SequenceEqual(new[]
                        {
                            new IndexNode<int>
                            {
                                Index = 4,
                                DenseIndex = 0,
                                Data = new ListIndexDelta<int>
                                {
                                    DeleteItems = new[] { -1 },
                                },
                            }
                        }, new IndexNodeComparer<int>()));
                });

            i.States().Skip(1).Take(1).Check(
                () =>
                    {
                        x.PublishInner.RemoveAt(0);
                        y.PublishInner.RemoveAt(0);
                    },
                state =>
                {
                    var s = state.Single();
                    Assert.IsTrue(s.Status == StateStatus.Connected);
                    Assert.IsTrue(s.Delta.HasChange());
                    Assert.IsTrue(s.Inner.SequenceEqual(new[] { 1, 2, 4 }));
                    Assert.IsTrue(s.Delta.IndexDeltas.SequenceEqual(new[]
                        {
                            new IndexNode<int>
                            {
                                Index = 0,
                                DenseIndex = 0,
                                Data = new ListIndexDelta<int>
                                {
                                    DeleteItems = new[] { 0 },
                                },
                            },
                            new IndexNode<int>
                            {
                                Index = 2,
                                DenseIndex = 1,
                                Data = new ListIndexDelta<int>
                                {
                                    DeleteItems = new[] { 3 },
                                },
                            }
                        },
                        new IndexNodeComparer<int>()));
                });
        }