anchor.diff:      expected.UndoStack <- expectedAction :: expected.UndoStack
       expected.RedoStack <- []
       expected.Status <- Some <| MainStatus.actionComplete expectedAction model.PathFormat
  -    comparer() |> assertAreEqualWith expected model
  +    assertAreEqualWith expected model (comparer())
   
   [<Test>]
   let ``Create folder handles error by setting error status``() =
  -    let fileSys = createUnauthorizedFileSys()
  -    let contr = createController fileSys
  +    let fsCreate nodeType path = raise ex
  +    let openPath path select (model: MainModel) = failwith "this should not be called"
       let createNode = newNodes.[1]
       let model = createModel()
  -    model.CommandInputMode <- Some CreateFolder
  -    model.CommandText <- createNode.Name
  -    contr.ExecuteCommand model
  +    MainHandler.create fsCreate openPath Folder createNode.Name model
   
       let expected = createModel()
       expected |> MainStatus.setActionExceptionStatus (CreatedItem createNode) ex
  -    comparer() |> assertAreEqualWith expected model
  +    assertAreEqualWith expected model (comparer())
   
   [<Test>]
  -let ``Rename calls fileSys.Move, reloads nodes and sets cursor``() =
  -    let fileSys = createFileSys()
  -    let contr = createController fileSys
  +let ``Rename calls fsMove, openPath and sets status``() =
  +    let mutable renamed : (Path * Path) option = None
  +    let fsMove path newPath = renamed <- Some (path, newPath)
  +    let openPath path select (model: MainModel) =
  +        model.Nodes <- newNodes
  +        model.Cursor <- 1
       let newName = newNodes.[1].Name
       let model = createModel()
       model.Cursor <- 1
  -    model.CommandInputMode <- Some (Rename Begin)
  -    model.CommandText <- newName
  -    contr.ExecuteCommand model
  +    MainHandler.rename fsMove openPath oldNodes.[1] newName model
   
  -    let oldPath = oldNodes.[1].Path
  -    let newPath = newNodes.[1].Path
  -    verify <@ fileSys.Move oldPath newPath @> once
  +    renamed |> shouldEqual (Some (oldNodes.[1].Path, newNodes.[1].Path))
       let expectedAction = RenamedItem (oldNodes.[1], newName)
       let expected = createModel()
       expected.Nodes <- newNodes
  
positive.code:     expected.UndoStack <- expectedAction :: expected.UndoStack
      expected.RedoStack <- []
      expected.Status <- Some <| MainStatus.actionComplete expectedAction model.PathFormat
      comparer() |> assertAreEqualWith expected model
  
  [<Test>]
  let ``Rename handles error by setting error status``() =
      let fileSys = createUnauthorizedFileSys()
      let contr = createController fileSys
      let model = createModel()
      model.Cursor <- 1
      model.CommandInputMode <- Some (Rename Begin)
      model.CommandText <- newNodes.[1].Name
      contr.ExecuteCommand model
  
      let expected = createModel()
      expected.Cursor <- 1
      expected |> MainStatus.setActionExceptionStatus (RenamedItem (oldNodes.[1], newNodes.[1].Name)) ex
      comparer() |> assertAreEqualWith expected model
  
  
  let renameTextSelection cursorPosition fileName =
      let fileSys = createFileSys()
      let contr = createController fileSys
      let model = createModel()
      let node = { Path = createPath "path3"; Name = fileName; Type = File;
                   Modified = None; Size = None; IsHidden = false; IsSearchMatch = false }
      model.Nodes <- List.append oldNodes [node]
      model.Cursor <- model.Nodes.Length - 1
      contr.StartInput (Rename cursorPosition) model
  
      model.CommandInputMode |> shouldEqual (Some (Rename cursorPosition))
      model.CommandText |> shouldEqual node.Name
  
negative.code: 
  let ex = UnauthorizedAccessException()
  
  let comparer () =
      CompareLogic() |> ignoreMembers ["CommandText"]
  
  [<Test>]
  let ``Create folder calls fsCreate, openPath and sets status``() =
      let mutable created : (NodeType * Path) option = None
      let fsCreate nodeType path = created <- Some (nodeType, path)
      let openPath path select (model: MainModel) =
          model.Nodes <- newNodes
          model.Cursor <- 1
      let createNode = newNodes.[1]
      let model = createModel()
      MainHandler.create fsCreate openPath Folder createNode.Name model
  
      created |> shouldEqual (Some (createNode.Type, createNode.Path))
      let expectedAction = CreatedItem createNode
      let expected = createModel()
      expected.Nodes <- newNodes
  