public void GetConfigFilePath_ShouldReturnNone_IfAFileNotExists() { var env = A.Fake <IEnvironment>(); A.CallTo(() => env.GetCurrentDirectory()).Returns(@"c:\test"); A.CallTo(() => env.FileExists(@"c:\test\dbup.yml")).Returns(false); var configPath = ConfigLoader.GetFilePath(env, "dbup.yml"); configPath.HasValue.Should().BeFalse(); }
public void GetConfigFilePath_ShouldReturnAValidFileName_IfAnAbsolutePathSpecified() { var env = A.Fake <IEnvironment>(); A.CallTo(() => env.GetCurrentDirectory()).Returns(@"c:\test"); A.CallTo(() => env.FileExists(@"d:\temp\scripts\dbup.yml")).Returns(true); var configPath = ConfigLoader.GetFilePath(env, @"d:\temp\scripts\dbup.yml"); configPath.HasValue.Should().BeTrue(); configPath.MatchSome(x => x.Should().Be(@"d:\temp\scripts\dbup.yml")); }
public void GetConfigFilePath_ShouldReturnFileFromTheCurrentDirectory_IfOnlyAFilenameSpecified() { var env = A.Fake <IEnvironment>(); A.CallTo(() => env.GetCurrentDirectory()).Returns(@"c:\test"); A.CallTo(() => env.FileExists(@"c:\test\dbup.yml")).Returns(true); var configPath = ConfigLoader.GetFilePath(env, "dbup.yml"); configPath.HasValue.Should().BeTrue(); configPath.MatchSome(x => x.Should().Be(@"c:\test\dbup.yml")); }