Beispiel #1
0
        public void Load()
        {
            var appOrders = getPrefs().GetStringSet("prefsAppOrder", new List <string> ()).ToList();

            var ordering = new List <AppOrder> ();


            foreach (var s in appOrders)
            {
                var parts = s.Split(new char [] { '|' }, 2);

                if (parts.Length == 2)
                {
                    int order = 0;
                    if (int.TryParse(parts [0], out order))
                    {
                        ordering.Add(new AppOrder {
                            Order       = order,
                            PackageName = parts [1]
                        });
                    }
                }
            }

            ordering.Sort((o1, o2) => o1.Order.CompareTo(o2.Order));

            lock (orderingLockObj) {
                Ordering.Clear();
                Ordering.AddRange(ordering);
            }
        }
Beispiel #2
0
            public void When_ClearingList_Expect_EmptyList()
            {
                // Arrange
                Ordering <TestClass> ordering = new Ordering <TestClass>
                {
                    new OrderBy(nameof(TestClass.Property1)),
                    new OrderBy(nameof(TestClass.Property2)),
                    new OrderBy(nameof(TestClass.Property3)),
                };

                // Act
                ordering.Clear();

                // Assert
                Assert.Empty(ordering);
            }
Beispiel #3
0
        public void Load()
        {
            var appOrders = getPrefs().GetStringSet("prefsAppOrder", new List <string> ()).ToList();

            var ordering = new List <AppOrder> ();


            foreach (var s in appOrders)
            {
                var parts = s.Split(new char [] { '|' }, 2);

                if (parts.Length == 2)
                {
                    int order = 0;
                    if (int.TryParse(parts [0], out order))
                    {
                        ordering.Add(new AppOrder {
                            Order       = order,
                            PackageName = parts [1]
                        });
                    }
                }
            }

            ordering.Sort((o1, o2) => o1.Order.CompareTo(o2.Order));

            lock (orderingLockObj) {
                Ordering.Clear();
                Ordering.AddRange(ordering);
            }


            Blacklist = getPrefs().GetStringSet("prefsBlacklist", new List <string> {
                "com.altusapps.firedtvlauncher",
                "com.amazon.avod",
                "com.amazon.bueller.photos",
                "com.amazon.device.bluetoothdfu",
                "com.amazon.device.gmo",
                "com.amazon.venezia",
                "com.amazon.storm.lightning.tutorial",
                "com.broadcom.wfd.client",
                "com.amazon.cpl",
            }).ToList();
        }
        public void OrderingShouldListenForChangesAddingRemovingClearing()
        {
            //order.Add(newEntree);
            //order.Add(newSide);
            // order.Add(newDrink);

            Assert.PropertyChanged(order, "Subtotal", () => order.Add(newEntree));
            Assert.PropertyChanged(order, "Subtotal", () => order.Add(newSide));
            Assert.PropertyChanged(order, "Subtotal", () => order.Add(newDrink));
            Assert.PropertyChanged(order, "Tax", () => order.Add(newEntree));
            Assert.PropertyChanged(order, "Tax", () => order.Add(newSide));
            Assert.PropertyChanged(order, "Tax", () => order.Add(newDrink));
            Assert.PropertyChanged(order, "Total", () => order.Add(newEntree));
            Assert.PropertyChanged(order, "Total", () => order.Add(newSide));
            Assert.PropertyChanged(order, "Total", () => order.Add(newDrink));
            Assert.PropertyChanged(order, "Calories", () => order.Add(newEntree));
            Assert.PropertyChanged(order, "Calories", () => order.Add(newSide));
            Assert.PropertyChanged(order, "Calories", () => order.Add(newDrink));

            Assert.PropertyChanged(order, "Subtotal", () => order.Remove(newEntree));
            Assert.PropertyChanged(order, "Subtotal", () => order.Remove(newSide));
            Assert.PropertyChanged(order, "Subtotal", () => order.Remove(newDrink));
            Assert.PropertyChanged(order, "Tax", () => order.Remove(newEntree));
            Assert.PropertyChanged(order, "Tax", () => order.Remove(newSide));
            Assert.PropertyChanged(order, "Tax", () => order.Remove(newDrink));
            Assert.PropertyChanged(order, "Total", () => order.Remove(newEntree));
            Assert.PropertyChanged(order, "Total", () => order.Remove(newSide));
            Assert.PropertyChanged(order, "Total", () => order.Remove(newDrink));
            Assert.PropertyChanged(order, "Calories", () => order.Remove(newEntree));
            Assert.PropertyChanged(order, "Calories", () => order.Remove(newSide));
            Assert.PropertyChanged(order, "Calories", () => order.Remove(newDrink));

            Assert.PropertyChanged(order, "Subtotal", () => order.Clear());

            Assert.PropertyChanged(order, "Tax", () => order.Clear());

            Assert.PropertyChanged(order, "Total", () => order.Clear());

            Assert.PropertyChanged(order, "Calories", () => order.Clear());
        }