Ejemplo n.º 1
0
        public void entity_with_initial_value_set_property_multiple_times_using_different_values_should_raise_propertyChanged_events_as_expected()
        {
            var expected = 3;
            var actual   = 0;

            var target = new MockEntity("initial value");

            target.PropertyChanged += (s, e) => actual++;

            target.FirstName = "Mauro";
            target.FirstName = "Foo";
            target.FirstName = "Foo";
            target.FirstName = "Mauro";

            actual.Should().Be.EqualTo(expected);
        }
Ejemplo n.º 2
0
        public void entity_property_set_on_property_with_cascade_notification_should_raise_all_expected_notifications()
        {
            var expected = 2;
            var actual   = 0;

            var expectedNotifications = new[] { "MainProperty", "SubProperty" };
            var actualNotifications   = new List <string>();

            var target = new MockEntity();

            target.PropertyChanged += (s, e) =>
            {
                actual++;
                actualNotifications.Add(e.PropertyName);
            };

            target.MainProperty = "foo...";

            actual.Should().Be.EqualTo(expected);
            actualNotifications.Should().Have.SameSequenceAs(expectedNotifications);
        }