Ejemplo n.º 1
0
            internal void Should_initialize_new_config_from_command_line_options_When_config_file_does_not_exist(
                TestResolveDependencyCommand command,
                GetDependenciesOptions options,
                string fileName)
            {
                command.FileSystem.FileExists(Arg.Any <string>()).Returns(false);

                DependencyConfig config = command.LoadConfigFile(options, fileName);

                Assert.Equal(options.BuildConfigId, config.BuildConfigId);
                Assert.Empty(config.BuildInfos);
            }
Ejemplo n.º 2
0
            internal void Should_throw_exception_if_Force_is_false_AND_Config_file_not_found_When_config_file_does_not_exist(
                TestResolveDependencyCommand command,
                GetDependenciesOptions options,
                string fileName)
            {
                command.FileSystem.FileExists(Arg.Any <string>()).Returns(false);

                //BuildConfigId set to null will cause Force == false
                options.BuildConfigId = null;

                Exception exception = Assert.Throws <Exception>(() => command.LoadConfigFile(options, fileName));

                Assert.True(exception.Message.StartsWith("Config file not found"));
            }
Ejemplo n.º 3
0
            public void Should_throw_exception_when_config_not_found(IFixture fixture,
                                                                     TestResolveDependencyCommand command)
            {
                string executingDir = @"c:\projects\projectA\src\";
                string config       = "dependencies.config";

                command.FileSystem.FileExists(Arg.Any <string>()).Returns(false);

                command.FileSystem.ReadAllTextFromFile(Arg.Any <string>()).Returns(EmptyConfigJson);

                var options = fixture.Build <GetDependenciesOptions>()
                              .With(x => x.ConfigFilePath, executingDir)
                              .Without(x => x.BuildConfigId)
                              .Create();

                Exception exception = Assert.Throws <Exception>(() => command.LoadConfigFile(options, config));

                Assert.True(exception.Message.StartsWith("Config file not found"));
            }