Exemple #1
0
        public void TestMoving()
        {
            ReactiveList <string> list = new ReactiveArrayList <string> {
                "A", "B", "C"
            };

            Assert.AreEqual(3, list.Count);
            list.Move("B", list.Count - 1);
            Assert.AreEqual(3, list.Count);
            Assert.IsTrue(list.SequenceEqual(new[] { "A", "C", "B" }));

            list.Move("A", 0);
            Assert.AreEqual(3, list.Count);
            Assert.IsTrue(list.SequenceEqual(new[] { "A", "C", "B" }));
        }
Exemple #2
0
        public void TestMovingMultipleOccurrences()
        {
            ReactiveList <string> list = new ReactiveArrayList <string> {
                "A", "B", "A", "C"
            };

            list.Move("A", list.Count - 1);
            Assert.IsTrue(list.SequenceEqual(new[] { "B", "A", "C", "A" }));
        }
Exemple #3
0
        public void TestMovingForwardObservables()
        {
            //Setup
            var scheduler = new TestScheduler();
            ReactiveList <string> list = new ReactiveArrayList <string> {
                "A", "B", "C", "D", "E"
            };

            //Define actions
            scheduler.Schedule(TimeSpan.FromTicks(10), () => list.Move("B", 3));
            var actual = scheduler.Start(() => list.OnMoved, created: 0, subscribed: 0, disposed: 100);

            //Assert
            Assert.AreEqual(1, actual.Messages.Count);
            foreach (var actualMessages in actual.Messages)
            {
                Assert.True(Enumerable.SequenceEqual(actualMessages.Value.Value.Changes, new[]