public void Unproxied_ReportsChanges_WhenChangesWereMade()
        {
            var interceptable = new InterceptableItem();

            interceptable.BoolProperty = true;

            bool wasChanged = factory.OnSaving(interceptable);

            Assert.That(wasChanged);
        }
        public void Setting_LinkCollectionProperty_AssignesTo_DetailCollection_typed()
        {
            var values = new InterceptableItem[] { new InterceptableItem {
                                                       ID = 1
                                                   }, new InterceptableItem {
                                                       ID = 2
                                                   } };

            item.TypedCollectionProperty = values;
            Assert.That(item.GetDetailCollection("TypedCollectionProperty", false), Is.EquivalentTo(values));
        }
        public void Getting_LinkCollectionProperty_ReadsFrom_DetailCollection_typed()
        {
            var values = new InterceptableItem[] { new InterceptableItem {
                                                       ID = 1
                                                   }, new InterceptableItem {
                                                       ID = 2
                                                   } };

            item.GetDetailCollection("TypedCollectionProperty", true).AddRange(values);
            item.TypedCollectionProperty.ShouldBe(values);
        }
        public void Unproxied_DoesntReportChanges_WhenNoChangesWereMade()
        {
            var interceptable = new InterceptableItem();

            interceptable.SetDetail("BoolProperty", false, typeof(bool));
            interceptable.SetDetail("EnumProperty", TextBoxMode.SingleLine, typeof(TextBoxMode));
            interceptable.SetDetail("StringProperty", null, typeof(string));

            bool wasChanged = factory.OnSaving(interceptable);

            Assert.That(wasChanged, Is.False);
        }
        public void Unproxied_StoresChanges_OnSaving()
        {
            var interceptable = new InterceptableItem();

            interceptable.BoolProperty   = true;
            interceptable.EnumProperty   = TextBoxMode.Password;
            interceptable.StringProperty = "hello";

            factory.OnSaving(interceptable);

            Assert.That(interceptable.GetDetail("BoolProperty"), Is.EqualTo(true));
            Assert.That(interceptable.GetDetail("EnumProperty"), Is.EqualTo(TextBoxMode.Password));
            Assert.That(interceptable.GetDetail("StringProperty"), Is.EqualTo("hello"));
        }
        public void Unproxied_StoresChanges_OnSaving()
        {
            var interceptable = new InterceptableItem();

            interceptable.BoolProperty = true;
            interceptable.EnumProperty = TextBoxMode.Password;
            interceptable.StringProperty = "hello";

            factory.OnSaving(interceptable);

            Assert.That(interceptable.GetDetail("BoolProperty"), Is.EqualTo(true));
            Assert.That(interceptable.GetDetail("EnumProperty"), Is.EqualTo(TextBoxMode.Password));
            Assert.That(interceptable.GetDetail("StringProperty"), Is.EqualTo("hello"));
        }
 public void SetUp()
 {
     item = factory.Create(typeof(InterceptableItem).FullName, 0) as InterceptableItem;
 }
        public void Unproxied_ReportsChanges_WhenChangesWereMade()
        {
            var interceptable = new InterceptableItem();

            interceptable.BoolProperty = true;

            bool wasChanged = factory.OnSaving(interceptable);

            Assert.That(wasChanged);
        }
        public void Unproxied_DoesntReportChanges_WhenNoChangesWereMade()
        {
            var interceptable = new InterceptableItem();
            interceptable.SetDetail("BoolProperty", false, typeof(bool));
            interceptable.SetDetail("EnumProperty", TextBoxMode.SingleLine, typeof(TextBoxMode));
            interceptable.SetDetail("StringProperty", null, typeof(string));

            bool wasChanged = factory.OnSaving(interceptable);

            Assert.That(wasChanged, Is.False);
        }
 public void SetUp()
 {
     item = factory.Create(typeof(InterceptableItem).FullName, 0) as InterceptableItem;
 }
		public void Getting_LinkCollectionProperty_ReadsFrom_DetailCollection_typed()
		{
			var values = new InterceptableItem[] { new InterceptableItem { ID = 1 }, new InterceptableItem { ID = 2 } };
			item.GetDetailCollection("TypedCollectionProperty", true).AddRange(values);
			item.TypedCollectionProperty.ShouldBe(values);
		}
		public void Setting_LinkCollectionProperty_AssignesTo_DetailCollection_typed()
		{
			var values = new InterceptableItem[] { new InterceptableItem { ID = 1 }, new InterceptableItem { ID = 2 } };
			item.TypedCollectionProperty = values;
			Assert.That(item.GetDetailCollection("TypedCollectionProperty", false), Is.EquivalentTo(values));
		}