本文整理汇总了C#中Topics.Radical.ChangeTracking.ChangeTrackingService.Undo方法的典型用法代码示例。如果您正苦于以下问题:C# ChangeTrackingService.Undo方法的具体用法?C# ChangeTrackingService.Undo怎么用?C# ChangeTrackingService.Undo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Topics.Radical.ChangeTracking.ChangeTrackingService
的用法示例。
在下文中一共展示了ChangeTrackingService.Undo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: changeTrackingService_hasTransientEntities_should_be_true_after_undo
public void changeTrackingService_hasTransientEntities_should_be_true_after_undo()
{
var svc = new ChangeTrackingService();
var p = new Person( svc, true );
svc.Undo();
svc.HasTransientEntities.Should().Be.True();
}
示例2: after_Undo_collection_is_rolledback
public void after_Undo_collection_is_rolledback()
{
Int32 expected = 0;
IChangeTrackingService svc = new ChangeTrackingService();
PersonCollection p = new PersonCollection( svc );
p.Add( new Person( svc, false ) );
svc.Undo();
p.Count.Should().Be.EqualTo( expected );
}
示例3: after_multiple_change_canRedo_is_false
public void after_multiple_change_canRedo_is_false()
{
ChangeTrackingService svc = new ChangeTrackingService();
Person p = new Person( svc, false );
p.Name = "Mauro";
svc.Undo();
p.Name = "Foo";
Assert.IsFalse( svc.CanRedo );
}
示例4: afterUndo_service_canRedo
public void afterUndo_service_canRedo()
{
ChangeTrackingService svc = new ChangeTrackingService();
Person p = new Person( svc, false );
p.Name = "Mauro";
svc.Undo();
Assert.IsTrue( svc.CanRedo );
}
示例5: service_after_redo_CanRedo_is_false
public void service_after_redo_CanRedo_is_false()
{
String expected = "Mauro";
ChangeTrackingService svc = new ChangeTrackingService();
Person p = new Person( svc );
p.Name = expected;
svc.Undo();
svc.Redo();
Assert.IsFalse( svc.CanRedo );
}
示例6: afterUndo_service_Redo_restore_previous_value
public void afterUndo_service_Redo_restore_previous_value()
{
ChangeTrackingService svc = new ChangeTrackingService();
Int32 expected = 1;
PersonCollection p = new PersonCollection( svc );
p.Add( new Person( null, false ) );
svc.Undo();
svc.Redo();
Assert.AreEqual<Int32>( expected, p.Count );
}
示例7: changeTrackingService_using_beginAtomicOperation_should_fully_rollback_on_single_undo
public void changeTrackingService_using_beginAtomicOperation_should_fully_rollback_on_single_undo()
{
var target = new ChangeTrackingService();
var person = new Person( target );
var list = new PersonCollection( target );
using( var actual = target.BeginAtomicOperation() )
{
person.Name = "Mauro";
list.Add( person );
person.Name = "Mauro Servienti";
actual.Complete();
}
target.Undo();
list.Count.Should().Be.EqualTo( 0 );
person.Name.Should().Be.EqualTo( String.Empty );
}
示例8: afterUndo_propertyValue_is_rolledback
public void afterUndo_propertyValue_is_rolledback()
{
ChangeTrackingService svc = new ChangeTrackingService();
Person p = new Person( svc, false );
String expected = p.Name;
p.Name = "Mauro";
svc.Undo();
Assert.AreEqual<String>( expected, p.Name );
}
示例9: after_suspend_cannot_call_Redo
public void after_suspend_cannot_call_Redo()
{
ChangeTrackingService svc = new ChangeTrackingService();
Person p = new Person( svc );
p.Name = "Mauro";
svc.Undo();
svc.Suspend();
svc.Redo();
}
示例10: service_on_undo_of_last_change_entity_if_tansient_has_forward_changes_and_is_transient
public void service_on_undo_of_last_change_entity_if_tansient_has_forward_changes_and_is_transient()
{
EntityTrackingStates expected = EntityTrackingStates.IsTransient | EntityTrackingStates.AutoRemove | EntityTrackingStates.HasForwardChanges;
ChangeTrackingService svc = new ChangeTrackingService();
Person p = new Person( svc );
p.Name = "Mauro";
svc.Undo();
EntityTrackingStates actual = svc.GetEntityState( p );
Assert.AreEqual<EntityTrackingStates>( expected, actual );
}
示例11: service_on_undo_of_last_change_entity_if_not_tansient_has_only_forward_changes
public void service_on_undo_of_last_change_entity_if_not_tansient_has_only_forward_changes()
{
EntityTrackingStates expected = EntityTrackingStates.HasForwardChanges;
ChangeTrackingService svc = new ChangeTrackingService();
Person p = new Person( svc, false );
p.Name = "Mauro";
svc.Undo();
EntityTrackingStates actual = svc.GetEntityState( p );
Assert.AreEqual<EntityTrackingStates>( expected, actual );
}
示例12: service_cannot_revert_to_an_invalid_bookmark
public void service_cannot_revert_to_an_invalid_bookmark()
{
ChangeTrackingService svc = new ChangeTrackingService();
Person p = new Person( svc );
p.Name = "Mauro";
var bmk = svc.CreateBookmark();
svc.Undo();
svc.Revert( bmk );
}
示例13: service_redoes_are_in_the_correct_order
public void service_redoes_are_in_the_correct_order()
{
var p1 = new Person( null, false );
var p2 = new Person( null, false );
var p3 = new Person( null, false );
ChangeTrackingService svc = new ChangeTrackingService();
PersonCollection list = new PersonCollection( svc );
list.Add( p1 );
list.Add( p2 );
list.Add( p3 );
list.Move( p2, 0 );
list.Remove( p1 );
while( svc.CanUndo )
{
svc.Undo();
}
svc.Redo();
Assert.AreEqual<Int32>( 1, list.Count );
Assert.IsTrue( list.Contains( p1 ) );
svc.Redo();
Assert.AreEqual<Int32>( 2, list.Count );
Assert.IsTrue( list.Contains( p2 ) );
svc.Redo();
Assert.AreEqual<Int32>( 3, list.Count );
Assert.IsTrue( list.Contains( p3 ) );
svc.Redo();
Assert.AreEqual<Int32>( 0, list.IndexOf( p2 ) );
svc.Redo();
Assert.AreEqual<Int32>( 2, list.Count );
Assert.IsFalse( list.Contains( p1 ) );
}
示例14: service_on_clear_undo_entities_are_restored
public void service_on_clear_undo_entities_are_restored()
{
var source = new Person[]
{
new Person( null, false ),
new Person( null, false ),
new Person( null, false ),
new Person( null, false ),
new Person( null, false )
};
ChangeTrackingService svc = new ChangeTrackingService();
PersonCollection list = new PersonCollection( svc );
list.BeginInit();
list.AddRange( source );
list.EndInit();
list.Clear();
svc.Undo();
Assert.AreEqual<Int32>( source.Length, list.Count() );
source.ForEach( p =>
{
Int32 expected = Array.IndexOf( source, p );
Int32 actual = list.IndexOf( p );
Assert.AreEqual<Int32>( expected, actual );
} );
}
示例15: afterUndo_service_Redo_restore_previous_value
public void afterUndo_service_Redo_restore_previous_value()
{
ChangeTrackingService svc = new ChangeTrackingService();
String expected = "Mauro";
Person p = new Person( svc, false );
p.Name = expected;
svc.Undo();
svc.Redo();
Assert.AreEqual<String>( expected, p.Name );
}