public void CreateDirectoryAlreadyExistsTest() { // Arrange var table = "MyTable"; var tableRoot = @"\MyTableDir"; var dirStructure = @"dir1\dir2\dir3"; var dirManager = new DirectoryManager(); var fileTableRepo = new Mock <FileTableRepo>(); fileTableRepo.Setup(m => m.FindPath(table, dirStructure, true, It.IsAny <SqlConnection>())).Returns("ABC12303"); fileTableRepo.Setup(m => m.GetTableRootPath(table, 0, null)).Returns(tableRoot); dirManager.FileTableRepo = fileTableRepo.Object; // Act var pathId = dirManager.CreateDirectory(table, dirStructure, null); // Assert Assert.AreEqual("ABC12303", pathId); }