anchor.diff:      expected.Path <- createPath "other"
       expected |> MainStatus.setActionExceptionStatus (MovedItem (curNode, prevNode.Path)) ex
       assertAreEqual expected model
  -
  -
  -[<TestCase(false)>]
  -[<TestCase(true)>]
  -let ``Redo move item moves it from original path again`` curPathDifferent =
  -    let fileSys = fileSysMock().Create()
  -    let contr = createController fileSys
  -    let sourceNode = newNodes.[1] |> withParent "source"
  -    let newNode = newNodes.[1]
  -    let action = MovedItem (sourceNode, newNode.Path)
  -    let otherItem = Some (createNode "other" "other", Move)
  -    let model = createModel()
  -    model.RedoStack <- action :: model.RedoStack
  -    model.ItemBuffer <- otherItem
  -    if curPathDifferent then
  -        model.Path <- createPath "other"
  -        model.Cursor <- 5
  -    contr.Redo model |> Async.RunSynchronously
  -
  -    let sourcePath = sourceNode.Path
  -    let name = newNode.Path
  -    verify <@ fileSys.Move sourcePath name @> once
  -    let expected = createModel()
  -    expected.Nodes <- newNodes
  -    expected.Cursor <- 1
  -    expected.UndoStack <- action :: expected.UndoStack
  -    expected.ItemBuffer <- otherItem
  -    expected.Status <- Some <| MainStatus.redoAction action model.PathFormat
  -    if curPathDifferent then
  -        expected.BackStack <- (createPath "other", 5) :: expected.BackStack
  -        expected.ForwardStack <- []
  -    assertAreEqual expected model
  -
   
   
   [<TestCase(false)>]
  
positive.code:     MainController(fileSys, settingsFactory, Config(), None)
  
  
  [<Test>]
  let ``Undo with empty undo stack sets status only``() =
      let fileSys = Mock.Of<IFileSystemService>()
      let contr = createController fileSys
      let model = createModel()
      model.UndoStack <- []
      contr.Undo model |> Async.RunSynchronously
  
      let expected = createModel()
      expected.UndoStack <- []
      expected.Status <- Some <| MainStatus.noUndoActions
      assertAreEqual expected model
  
  [<Test>]
  let ``Redo with empty stack sets status only``() =
      let fileSys = Mock.Of<IFileSystemService>()
      let contr = createController fileSys
      let model = createModel()
      model.RedoStack <- []
      contr.Redo model |> Async.RunSynchronously
  
      let expected = createModel()
      expected.RedoStack <- []
      expected.Status <- Some <| MainStatus.noRedoActions
      assertAreEqual expected model
  
  
  
  [<TestCase(1, false)>]
  [<TestCase(2, false)>]
  [<TestCase(1, true)>]
  let ``Undo create item deletes if empty`` nodeIndex curPathDifferent =
      let fileSys =
          fileSysMock()
              .Setup(fun x -> <@ x.IsEmpty (any()) @>).Returns(true)
              .Create()
      let contr = createController fileSys
      let createdNode = oldNodes.[nodeIndex]
      let action = CreatedItem createdNode
      let model = createModel()
      model.UndoStack <- action :: model.UndoStack
      model.Status <- Some <| ErrorMessage "prev error"
      model.Cursor <- 5
      if curPathDifferent then
          model.Path <- createPath "other"
      contr.Undo model |> Async.RunSynchronously
  
      let expectedPath = createdNode.Path
      verify <@ fileSys.Delete expectedPath @> once
      let expected = createModel()
      expected.RedoStack <- action :: expected.RedoStack
      expected.Status <- Some <| MainStatus.undoAction action model.PathFormat
      if curPathDifferent then
          expected.Path <- createPath "other"
          expected.Cursor <- 5
      else
          expected.Nodes <- newNodes
          expected.Cursor <- newNodes.Length - 1
      assertAreEqual expected model
  
  
  [<TestCase(false)>]
  [<TestCase(true)>]
  let ``Undo create item handles error by setting error status and consumes action`` isEmptyThrows =
      let fsMock =
          if isEmptyThrows then
              fileSysMock().Setup(fun x -> <@ x.IsEmpty (any()) @>).Raises(ex)
          else
              fileSysMock().Setup(fun x -> <@ x.IsEmpty (any()) @>).Returns(true)
      let fileSys =
          fsMock
              .Setup(fun x -> <@ x.Delete (any()) @>).Raises(ex)
              .Create()
      let contr = createController fileSys
      let model = createModel()
      let action = CreatedItem oldNodes.[0]
      model.Path <- createPath "other"
      model.UndoStack <- action :: model.UndoStack
      contr.Undo model |> Async.RunSynchronously
  
      let expected = createModel()
      expected.Path <- createPath "other"
      expected |> MainStatus.setActionExceptionStatus (DeletedItem (oldNodes.[0], true)) ex
      assertAreEqual expected model
  
  
  [<Test>]
  let ``Undo create item sets status if non-empty and consumes action``() =
      let fileSys =
          fileSysMock()
              .Setup(fun x -> <@ x.IsEmpty (any()) @>).Returns(false)
              .Create()
      let contr = createController fileSys
      let createdNode = oldNodes.[0]
      let action = CreatedItem createdNode
      let model = createModel()
      model.Path <- createPath "other"
      model.UndoStack <- action :: model.UndoStack
      contr.Undo model |> Async.RunSynchronously
  
      verify <@ fileSys.Delete (any()) @> never
      let expected = createModel()
      expected.Path <- createPath "other"
      expected.Status <- Some <| MainStatus.cannotUndoNonEmptyCreated createdNode
      assertAreEqual expected model
  
  
  [<TestCase(false)>]
  [<TestCase(true)>]
  let ``Redo create item creates item`` curPathDifferent =
      let fileSys = fileSysMock().Create()
      let contr = createController fileSys
      let createdNode = newNodes.[1]
      let action = CreatedItem createdNode
      let model = createModel()
      model.RedoStack <- action :: model.RedoStack
      if curPathDifferent then
          model.Path <- createPath "other"
          model.Cursor <- 5
      contr.Redo model |> Async.RunSynchronously
  
      let nodeType = createdNode.Type
      let path = createdNode.Path
      verify <@ fileSys.Create nodeType path @> once
      let expected = createModel()
      expected.Nodes <- newNodes
      expected.Cursor <- 1
      expected.Status <- Some <| MainStatus.redoAction action model.PathFormat
      expected.UndoStack <- action :: expected.UndoStack
      if curPathDifferent then
          expected.BackStack <- (createPath "other", 5) :: expected.BackStack
          expected.ForwardStack <- []
      assertAreEqual expected model
  
  
  
  [<TestCase(true)>]
  [<TestCase(false)>]
  let ``Undo rename item names file back to original`` curPathDifferent =
  
negative.code:     expected.Path <- createPath "other"
      expected |> MainStatus.setActionExceptionStatus (DeletedItem (copyNode, false)) ex
      assertAreEqual expected model
  