Пример #1
0
        public void Should_Use_OutputPath_When_Set()
        {
            var fixture = new VagrantFixture(r => r.Init("hashicorp/precise64", s => s.OutputToFile("test/vagrant")));
            var result  = fixture.Run();

            result.Args.Should().Be("init --output \"test/vagrant\" hashicorp/precise64");
        }
Пример #2
0
        public void Should_Use_Minimal_When_Set()
        {
            var fixture = new VagrantFixture(r => r.Init("hashicorp/precise64", s => s.CreateMinimal()));
            var result  = fixture.Run();

            result.Args.Should().Be("init --minimal hashicorp/precise64");
        }
Пример #3
0
        public void Should_Use_Version_Constraint_When_Set()
        {
            var fixture = new VagrantFixture(r => r.Init("hashicorp/precise64", s => s.ConstrainVersion("> 0.1.5")));
            var result  = fixture.Run();

            result.Args.Should().Be("init --box-version \"> 0.1.5\" hashicorp/precise64");
        }
Пример #4
0
        public void Should_Use_Force_When_Set()
        {
            var fixture = new VagrantFixture(r => r.Init("hashicorp/precise64", s => s.Force()));
            var result  = fixture.Run();

            result.Args.Should().Be($"init --force hashicorp/precise64");
        }
Пример #5
0
        public void Should_Include_Output_Path_When_Set(string path)
        {
            var fixture = new VagrantFixture(r => r.Package(s => s.OutputToFile(path)));
            var result  = fixture.Run();

            result.Args.Should().Be("package --output sample.box");
        }
Пример #6
0
        public void Should_Fail_When_Command_Not_Provided()
        {
            var fixture = new VagrantFixture(r => r.SSH(s => s.WithArguments("arg1")));
            var result  = Record.Exception(() => fixture.Run());

            result.Should().BeOfType <ArgumentOutOfRangeException>();
        }
Пример #7
0
        public void Should_Run_With_Defaults()
        {
            var fixture = new VagrantFixture(r => r.Resume());
            var result  = fixture.Run();

            result.Args.Should().Be("resume");
        }
Пример #8
0
        public void Should_Run_With_Defaults()
        {
            var fixture = new VagrantFixture(r => r.Destroy());
            var result  = fixture.Run();

            result.Args.Should().Be("destroy --force");
        }
Пример #9
0
        public void Should_Include_Name_When_Set()
        {
            var fixture = new VagrantFixture(r => r.Destroy("web"));
            var result  = fixture.Run();

            result.Args.Should().Be("destroy web --force");
        }
Пример #10
0
        public void Should_Load_Vagrantfile()
        {
            var fixture = new VagrantFixture(r => r.Package(s => s.IncludeVagrantFile("./src/Vagrantfile")));
            var result  = fixture.Run();

            result.Args.Should().Be("package --vagrantfile src/Vagrantfile");
        }
Пример #11
0
        public void Should_Run_With_Defaults()
        {
            var fixture = new VagrantFixture(r => r.Up());
            var result  = fixture.Run();

            result.Process.WorkingDirectory.FullPath.Should().Be("/Working");
        }
Пример #12
0
        public void Should_Include_Name_When_Set()
        {
            var fixture = new VagrantFixture(r => r.Resume("web"));
            var result  = fixture.Run();

            result.Args.Should().Be("resume web");
        }
Пример #13
0
        public void Should_Include_Single_File()
        {
            var fixture = new VagrantFixture(r => r.Package(s => s.IncludeInPackage("./file")));
            var result  = fixture.Run();

            result.Args.Should().Be("package --include file");
        }
Пример #14
0
        public void Should_Use_Name_When_Set()
        {
            var fixture = new VagrantFixture(r => r.Up("web"));
            var result  = fixture.Run();

            result.Args.Should().Be("up web");
        }
Пример #15
0
        public void Should_Use_Parallel_When_Set()
        {
            var fixture = new VagrantFixture(r => r.Up(s => s.EnableParallel()));
            var result  = fixture.Run();

            result.Args.Should().Be("up --parallel");
        }
Пример #16
0
        public void Should_Use_Destroy_When_Set(bool enableDestroy, string flagValue)
        {
            var fixture = new VagrantFixture(r => r.Up(s => s.DestroyOnError(enableDestroy)));
            var result  = fixture.Run();

            result.Args.Should().Be($"up {flagValue}");
        }
Пример #17
0
        public void Should_Install_Provider_When_Set(bool enable, string flagValue)
        {
            var fixture = new VagrantFixture(r => r.Up(s => s.InstallProvider(enable)));
            var result  = fixture.Run();

            result.Args.Should().Be($"up {flagValue}");
        }
Пример #18
0
        public void Should_Use_Provider_When_Set(string imageName, string providerName)
        {
            var fixture = new VagrantFixture(r => r.Up(imageName, s => s.UseProvider(providerName)));
            var result  = fixture.Run();

            result.Args.Should().Be($"up {imageName} --provider {providerName}");
        }
Пример #19
0
        public void Should_Include_Force_When_Set()
        {
            var fixture = new VagrantFixture(r => r.Halt(force: true));
            var result  = fixture.Run();

            result.Args.Should().Be("halt --force");
        }
Пример #20
0
        public void Should_Throw_On_NonExistent_Directory()
        {
            var fixture = new VagrantFixture(r => r.FromPath("./fake").Up());
            var action  = new Action(() => fixture.Run());

            action.ShouldThrow <DirectoryNotFoundException>().Where(e => e.Message.Contains("fake"));
        }
Пример #21
0
        public void Should_Use_Provision_When_Explicitly_Set()
        {
            var fixture = new VagrantFixture(r => r.Resume(s => s.RunProvisioners()));
            var result  = fixture.Run();

            result.Args.Should().Be("resume --provision");
        }
Пример #22
0
        public void Should_Run_With_Defaults(string imageName)
        {
            var fixture = new VagrantFixture(r => r.Init(imageName));
            var result  = fixture.Run();

            result.Args.Should().Be($"init {imageName}");
        }
Пример #23
0
        public void Should_Use_Provisioners()
        {
            var fixture = new VagrantFixture(r => r.Resume(s => s.WithProvisioners("chef", "shell")));
            var result  = fixture.Run();

            result.Args.Should().Be("resume --provision --provision-with chef,shell");
        }
Пример #24
0
        public void Should_Use_BaseName()
        {
            var fixture = new VagrantFixture(r => r.Package(s => s.UseBaseImage("vbox-vm")));
            var result  = fixture.Run();

            result.Args.Should().Be("package --base vbox-vm");
        }
Пример #25
0
        public void Should_Fail_When_Command_Not_Provided()
        {
            var fixture = new VagrantFixture(r => r.PowerShell(s => s.RunCommand(null)));
            var result  = Record.Exception(() => fixture.Run());

            result.Should().BeOfType <ArgumentOutOfRangeException>();
        }
Пример #26
0
        public void Should_Include_Extra_Args_When_Set(string args)
        {
            var fixture = new VagrantFixture(r => r.SSH(s => s.RunCommand("echo").WithArguments(args)));
            var result  = fixture.Run();

            result.Args.Should().Be($"ssh --command \"echo\" -- {args}");
        }
Пример #27
0
        public void Should_Set_Command_When_Provided(string command)
        {
            var fixture = new VagrantFixture(r => r.SSH(s => s.RunCommand(command)));
            var result  = fixture.Run();

            result.Args.Should().Be($"ssh --command \"{command}\"");
        }
Пример #28
0
        public void Should_Find_Executable_If_Tool_Path_Not_Provided()
        {
            // Given
            var fixture = new VagrantFixture(r => r.Up());
            var result  = fixture.Run();

            result.Path.FullPath.Should().Be("/Working/tools/vagrant.exe");
        }
Пример #29
0
        public void Should_Set_Valid_DirectoryPath()
        {
            var fixture = new VagrantFixture(r => r.FromPath("./vm").Up());

            fixture.FileSystem.CreateDirectory("./vm");

            var result = fixture.Run();

            result.Process.WorkingDirectory.FullPath.Should().Be("/Working/vm");
        }
Пример #30
0
        public void Should_Throw_If_Process_Was_Not_Started()
        {
            // Given
            var fixture = new VagrantFixture(r => r.Up());

            fixture.GivenProcessCannotStart();
            var action = new Action(() => fixture.Run());

            action.ShouldThrow <CakeException>().WithMessage("Vagrant by Hashicorp: Process was not started.");
        }