Exemplo n.º 1
0
        public void TestMethod_Set4()
        {
            TestBaseList.Add(Item1);
            TestBaseList.Add(Item2);
            TestBaseList.Add(Item3);

            ListAdapter = new ObservableListAdapterConcrete(TestBaseList);

            Assert.That(ListAdapter.Count, Is.EqualTo(3));
            Assert.That(Item1, Is.EqualTo(ListAdapter.First().BaseString));
            Assert.That(Item2, Is.EqualTo(ListAdapter[1].BaseString));
            Assert.That(Item3, Is.EqualTo(ListAdapter[2].BaseString));
            Assert.That(Item1 + ListAdapter.First().AddedString, Is.EqualTo(ListAdapter.First().StringView));
        }
Exemplo n.º 2
0
        public void TestMethod_Clear()
        {
            TestBaseList.Add(Item1);
            TestBaseList.Add(Item2);
            TestBaseList.Add(Item3);

            ListAdapter = new ObservableListAdapterConcrete(TestBaseList);

            Assert.That(ListAdapter.Count == 3);

            TestBaseList.Clear();

            Assert.That(ListAdapter.Count == 0);
        }
Exemplo n.º 3
0
        public void TestMethod_Remove()
        {
            TestBaseList.Add(Item1);
            TestBaseList.Add(Item2);
            TestBaseList.Add(Item3);

            ListAdapter = new ObservableListAdapterConcrete(TestBaseList);

            Assert.That(ListAdapter.Count == 3);

            TestBaseList.RemoveAt(1);

            Assert.That(ListAdapter.Count == 2);
            Assert.That(ListAdapter[0].BaseString == Item1);
            Assert.That(ListAdapter[1].BaseString == Item3);
        }
Exemplo n.º 4
0
        public void TestMethod_Replace()
        {
            TestBaseList.Add(Item1);
            TestBaseList.Add(Item2);
            TestBaseList.Add(Item3);

            ListAdapter = new ObservableListAdapterConcrete(TestBaseList);

            Assert.That(ListAdapter.Count == 3);

            var item4 = Fixture.Create <string>();

            TestBaseList[1] = item4;

            Assert.That(ListAdapter.Count == 3);
            Assert.That(ListAdapter[0].BaseString == Item1);
            Assert.That(ListAdapter[1].BaseString == item4);
            Assert.That(ListAdapter[2].BaseString == Item3);
        }
Exemplo n.º 5
0
        public void TestMethod_SetConstructorAndAdd()
        {
            ListAdapter = new ObservableListAdapterConcrete(TestBaseList);

            TestBaseList.PropertyChanged   += (sender, args) => AssertEvent.Call("PropertyChanged");
            TestBaseList.CollectionChanged += (sender, args) => AssertEvent.Call("CollectionChanged");

            TestBaseList.Add(Item1);
            TestBaseList.Add(Item2);
            TestBaseList.Add(Item3);

            Assert.That(ListAdapter.Count, Is.EqualTo(3));
            Assert.That(Item1, Is.EqualTo(ListAdapter.First().BaseString));
            Assert.That(Item2, Is.EqualTo(ListAdapter[1].BaseString));
            Assert.That(Item3, Is.EqualTo(ListAdapter[2].BaseString));
            Assert.That(Item1 + ListAdapter.First().AddedString, Is.EqualTo(ListAdapter.First().StringView));

            MockEvent.Verify(m => m.Call("PropertyChanged"), Times.Exactly(6));
            MockEvent.Verify(m => m.Call("CollectionChanged"), Times.Exactly(3));
        }