Пример #1
0
        public void entityMemento_cacheChangeOnRejectCallback_invalid_rejectReason_should_raise_EnumValueOutOfRangeException()
        {
            var iChange = A.Dummy <IChange>();
            var memento = A.Fake <IChangeTrackingService>();

            A.CallTo(() => memento.IsSuspended).Returns(false);

            var target = new TestableMementoEntity(memento);

            var value   = "foo";
            var rejArgs = new ChangeRejectedEventArgs <string>(target, value, iChange, (RejectReason)1000);

            target.InvokeCacheChangeOnRejectCallback(value, cv => { }, cv => { }, rejArgs);
        }
Пример #2
0
        public void entityMemento_chacheChangeOnRejectCallback_on_disposed_entity_should_raise_ObjectDisposedException()
        {
            var iChange = A.Dummy <IChange>();
            var memento = A.Fake <IChangeTrackingService>();

            A.CallTo(() => memento.IsSuspended).Returns(false);

            var target = new TestableMementoEntity(memento);

            target.Dispose();

            var value   = "foo";
            var rejArgs = new ChangeRejectedEventArgs <string>(target, value, iChange, RejectReason.Revert);

            target.InvokeCacheChangeOnRejectCallback(value, cv => { }, cv => { }, rejArgs);
        }
Пример #3
0
        public void entityMemento_cacheChangeOnRejectCallback_rejectReason_RejectChanges_should_return_null_iChange()
        {
            var iChange = A.Dummy <IChange>();
            var memento = A.Fake <IChangeTrackingService>();

            A.CallTo(() => memento.IsSuspended).Returns(false);

            var target = new TestableMementoEntity(memento);

            var value   = "foo";
            var rejArgs = new ChangeRejectedEventArgs <string>(target, value, iChange, RejectReason.RejectChanges);

            var actual = target.InvokeCacheChangeOnRejectCallback(value, cv => { }, cv => { }, rejArgs);

            actual.Should().Be.Null();
        }