public void Should_Create_New_Absolute_Path_Identical_To_The_Path() { // Given var path = new DirectoryPath("/assets"); // When var result = path.MakeAbsolute("/absolute"); // Then Assert.Equal("/assets", result.FullPath); }
public void Should_Create_New_Absolute_Path_When_Path_Is_Relative() { // Given var path = new DirectoryPath("assets"); // When var result = path.MakeAbsolute("/absolute"); // Then Assert.Equal("/absolute/assets", result.FullPath); }
public void Should_Throw_If_Provided_Path_Is_Relative() { // Given var path = new DirectoryPath("assets"); // When var result = Record.Exception(() => path.MakeAbsolute("Working")); // Then Assert.IsType<PathException>(result); Assert.Equal("The provided path cannot be relative.", result.Message); }
public void Should_Throw_If_Provided_Path_Is_Null() { // Given var path = new DirectoryPath("assets"); // When var result = Record.Exception( () => path.MakeAbsolute((DirectoryPath)null)); // Then Assert.IsType<ArgumentNullException>(result); Assert.Equal("path", ((ArgumentNullException)result).ParamName); }
public void Should_Create_New_Absolute_Path_Identical_To_The_Path() { // Given var environment = Substitute.For<IEnvironment>(); var path = new DirectoryPath("/assets"); // When var result = path.MakeAbsolute(environment); // Then Assert.Equal("/assets", result.FullPath); }
public void Should_Create_New_Absolute_Path_When_Path_Is_Relative() { // Given var environment = Substitute.For<IEnvironment>(); environment.GetApplicationRoot().Returns("/Working"); var path = new DirectoryPath("assets"); // When var result = path.MakeAbsolute(environment); // Then Assert.Equal("/Working/assets", result.FullPath); }