public void ShouldThrowExceptionWhenSourceDoesntExist() { var mockBounce = new Mock<IBounce>(); var from = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); var to = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); Assert.That(Directory.Exists(from), Is.False, "Directory " + from + " should not exist"); Assert.That(Directory.Exists(to), Is.False, "Directory " + to + " should not exist"); var rename = new RenameDirectory { From = from, To = to }; Assert.Throws<ArgumentException>(() => rename.Build(mockBounce.Object)); }
public void ShouldThrowExceptionWhenSourceDoesntExist() { var mockBounce = new Mock <IBounce>(); var from = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); var to = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); Assert.That(Directory.Exists(from), Is.False, "Directory " + from + " should not exist"); Assert.That(Directory.Exists(to), Is.False, "Directory " + to + " should not exist"); var rename = new RenameDirectory { From = from, To = to }; Assert.Throws <ArgumentException>(() => rename.Build(mockBounce.Object)); }
public void ShouldRenameDirectory() { var mockBounce = new Mock<IBounce>(); var from = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); var to = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); Directory.CreateDirectory(from); Assert.That(Directory.Exists(from), Is.True, "Directory " + from + " should exist"); Assert.That(Directory.Exists(to), Is.False, "Directory " + to + " should not exist"); var rename = new RenameDirectory { From = from, To = to }; rename.Build(mockBounce.Object); Assert.That(Directory.Exists(from), Is.False, "Directory " + from + " should not exist"); Assert.That(Directory.Exists(to), Is.True, "Directory " + to + " should exist"); Directory.Delete(to); }
public void ShouldThrowExceptionWhenTargetAlreadyExists() { var mockBounce = new Mock<IBounce>(); var from = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); var to = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); Directory.CreateDirectory(from); Directory.CreateDirectory(to); Assert.That(Directory.Exists(from), Is.True, "Directory " + from + " should exist"); Assert.That(Directory.Exists(to), Is.True, "Directory " + to + " should exist"); var rename = new RenameDirectory { From = from, To = to }; Assert.Throws<ArgumentException>(() => rename.Build(mockBounce.Object)); Assert.That(Directory.Exists(from), Is.True, "Directory " + from + " should exist"); Assert.That(Directory.Exists(to), Is.True, "Directory " + to + " should exist"); Directory.Delete(from); Directory.Delete(to); }
public void ShouldRenameDirectory() { var mockBounce = new Mock <IBounce>(); var from = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); var to = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); Directory.CreateDirectory(from); Assert.That(Directory.Exists(from), Is.True, "Directory " + from + " should exist"); Assert.That(Directory.Exists(to), Is.False, "Directory " + to + " should not exist"); var rename = new RenameDirectory { From = from, To = to }; rename.Build(mockBounce.Object); Assert.That(Directory.Exists(from), Is.False, "Directory " + from + " should not exist"); Assert.That(Directory.Exists(to), Is.True, "Directory " + to + " should exist"); Directory.Delete(to); }
public void ShouldThrowExceptionWhenTargetAlreadyExists() { var mockBounce = new Mock <IBounce>(); var from = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); var to = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); Directory.CreateDirectory(from); Directory.CreateDirectory(to); Assert.That(Directory.Exists(from), Is.True, "Directory " + from + " should exist"); Assert.That(Directory.Exists(to), Is.True, "Directory " + to + " should exist"); var rename = new RenameDirectory { From = from, To = to }; Assert.Throws <ArgumentException>(() => rename.Build(mockBounce.Object)); Assert.That(Directory.Exists(from), Is.True, "Directory " + from + " should exist"); Assert.That(Directory.Exists(to), Is.True, "Directory " + to + " should exist"); Directory.Delete(from); Directory.Delete(to); }