Ejemplo n.º 1
0
        public void ModifyItem()
        {
            var raisedItemEvents     = new List <ItemStateChangedEventArgs>();
            var raisedPropertyEvents = new List <PropertyChangedEventArgs>();

            Array <TestObject> a = Generator.Array(10, g => TestObject.GenerateRandom());

            a.ItemStateChanged += delegate(object sender, ItemStateChangedEventArgs e)
            {
                raisedItemEvents.Add(e);
            };
            a.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
            {
                raisedPropertyEvents.Add(e);
            };

            a[5].Value = 1234;

            Assert.Single(raisedItemEvents);
            Assert.Equal(5, raisedItemEvents[0].ItemIndex);
            Assert.Equal(nameof(TestObject.Value), raisedItemEvents[0].PropertyName);
            Assert.Empty(raisedPropertyEvents);
        }
Ejemplo n.º 2
0
        public void NullObject()
        {
            TestObject x = null;

            Assert.Throws <ArgumentNullException>(() => Serializer.Write(x));
        }