Example #1
0
        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();
        }
Example #2
0
        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"));
        }
Example #3
0
        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"));
        }