Esempio n. 1
0
        public void RejectChanges_On_Collection_Should_RejectChanges_Only_After_Last_AcceptChanges()
        {
            var orders    = Helper.GetOrdersIList();
            var trackable = orders.AsTrackable();

            var first = orders.First();

            first.Id             = 963;
            first.CustomerNumber = "Testing";
            var collectionIntf = trackable.CastToIChangeTrackableCollection();

            collectionIntf.AcceptChanges();
            first.Id             = 999;
            first.CustomerNumber = "Testing 123";
            collectionIntf.RejectChanges();
            var intf         = first.CastToIChangeTrackable();
            var orderToMatch = Helper.GetOrder();

            orderToMatch.Id             = 963;
            orderToMatch.CustomerNumber = "Testing";
            Order originalOrder = intf.GetOriginal();

            originalOrder.Should().BeEquivalentTo(orderToMatch, options => options.IgnoringCyclicReferences());
            intf.GetOriginalValue(o => o.Id).Should().Be(963);
        }
        public void AsTrackable_Should_Make_Object_Implement_INotifyPropertyChanged()
        {
            var order = Helper.GetOrder();

            Order trackable = order.AsTrackable();

            trackable.Should().BeAssignableTo <System.ComponentModel.INotifyPropertyChanged>();
        }
Esempio n. 3
0
        public void AsTrackable_Should_Make_Object_Implement_IChangeTrackable()
        {
            var order = Helper.GetOrder();

            Order trackable = order.AsTrackable();

            trackable.Should().BeAssignableTo <IChangeTrackable <Order> >();
        }
        public void AsTrackable_Should_Make_Object_Implement_IRevertibleChangeTracking()
        {
            var order = Helper.GetOrder();

            Order trackable = order.AsTrackable();

            trackable.Should().BeAssignableTo <System.ComponentModel.IRevertibleChangeTracking>();
        }
        public void AsTrackable_Should_Make_Object_Implement_IEditableObject()
        {
            var order = Helper.GetOrder();

            Order trackable = order.AsTrackable();

            trackable.Should().BeAssignableTo <System.ComponentModel.IEditableObject>();
        }
Esempio n. 6
0
        public void AsTrackable_Should_Take_MakeComplexPropertiesTrackable_From_Default()
        {
            ChangeTrackingFactory.Default.MakeComplexPropertiesTrackable = false;
            Order order = Helper.GetOrder();

            Order trackable = order.AsTrackable();

            trackable.Should().BeAssignableTo <IChangeTrackable <Order> >();
            trackable.Address.Should().NotBeAssignableTo <IChangeTrackable <Address> >();
            ChangeTrackingFactory.Default.MakeComplexPropertiesTrackable = true;
        }
Esempio n. 7
0
        public void AsTrackable_Should_Take_MakeCollectionPropertiesTrackable_From_Default()
        {
            ChangeTrackingFactory.Default.MakeCollectionPropertiesTrackable = false;
            Order order = Helper.GetOrder();

            Order trackable = order.AsTrackable();

            trackable.Should().BeAssignableTo <IChangeTrackable <Order> >();
            trackable.OrderDetails.Should().NotBeAssignableTo <IChangeTrackableCollection <OrderDetail> >();
            ChangeTrackingFactory.Default.MakeCollectionPropertiesTrackable = true;
        }