public void ItemContainerGeneratorBasicTest()
        {
            TestGeneratorHost host = new TestGeneratorHost();
            ItemContainerGenerator generator = new ItemContainerGenerator(host);

            ItemsChangedEventArgs lastChangedArg = null;

            generator.ItemsChanged += (sender, e) => lastChangedArg = e;

            host.View.Add("item1");
            Assert.AreEqual(NotifyCollectionChangedAction.Add, lastChangedArg.Action);
            Assert.AreEqual(0, lastChangedArg.NewStartingIndex);
            Assert.AreEqual(1, lastChangedArg.ItemsCount);
            Assert.AreEqual(0, lastChangedArg.ContainersCount);

            FrameworkElement container1 = generator.Generate(0);
            Assert.IsTrue(host.Containers.ContainsKey("item1"));
            Assert.AreEqual("item1", container1.GetValue(TestGeneratorHost.ItemForItemContainerProperty));

            host.View[0] = "item2";
            Assert.IsFalse(host.Containers.ContainsKey("item1"));
            Assert.IsTrue(host.Containers.ContainsKey("item2"));
            Assert.IsNull(container1.GetValue(TestGeneratorHost.ItemForItemContainerProperty));

            FrameworkElement container2 = generator.Generate(0);
            Assert.IsTrue(host.Containers.ContainsKey("item2"));
            Assert.AreEqual("item2", container2.GetValue(TestGeneratorHost.ItemForItemContainerProperty));

            host.View.Remove("item2");
            Assert.IsFalse(host.Containers.ContainsKey("item2"));
            Assert.IsNull(container2.GetValue(TestGeneratorHost.ItemForItemContainerProperty));

            host.View.Add("item3");
            Assert.IsFalse(host.Containers.ContainsKey("item3"));

            FrameworkElement container3 = generator.Generate(0);
            Assert.IsTrue(host.Containers.ContainsKey("item3"));
            Assert.AreEqual("item3", container3.GetValue(TestGeneratorHost.ItemForItemContainerProperty));

            generator.Dispose();
            Assert.IsFalse(host.Containers.ContainsKey("item3"));
            Assert.IsNull(container3.GetValue(TestGeneratorHost.ItemForItemContainerProperty));
        }