コード例 #1
0
            public void Should_Return_Provided_Process_Runner()
            {
                // Given
                var fixture = new CakeContextFixture();
                var context = fixture.CreateContext();

                // When
                var processRunner = context.ProcessRunner;

                // Then
                Assert.Same(fixture.ProcessRunner, processRunner);
            }
コード例 #2
0
            public void Should_Return_Provided_Arguments()
            {
                // Given
                var fixture = new CakeContextFixture();
                var context = fixture.CreateContext();

                // When
                var arguments = context.Arguments;

                // Then
                Assert.Same(fixture.Arguments, arguments);
            }
コード例 #3
0
            public void Should_Return_Provided_Log()
            {
                // Given
                var fixture = new CakeContextFixture();
                var context = fixture.CreateContext();

                // When
                var log = context.Log;

                // Then
                Assert.Same(fixture.Log, log);
            }
コード例 #4
0
            public void Should_Return_Provided_Globber()
            {
                // Given
                var fixture = new CakeContextFixture();
                var context = fixture.CreateContext();

                // When
                var globber = context.Globber;

                // Then
                Assert.Same(fixture.Globber, globber);
            }
コード例 #5
0
            public void Should_Return_Provided_Environment()
            {
                // Given
                var fixture = new CakeContextFixture();
                var context = fixture.CreateContext();

                // When
                var environment = context.Environment;

                // Then
                Assert.Same(fixture.Environment, environment);
            }
コード例 #6
0
            public void Should_Return_Provided_File_System()
            {
                // Given
                var fixture = new CakeContextFixture();
                var context = fixture.CreateContext();

                // When
                var fileSystem = context.FileSystem;

                // Then
                Assert.Same(fixture.FileSystem, fileSystem);
            }
コード例 #7
0
            public void Should_Throw_If_Process_Runner_Is_Null()
            {
                // Given
                var fixture = new CakeContextFixture();

                fixture.ProcessRunner = null;

                // When
                var result = Record.Exception(() => fixture.CreateContext());

                // Then
                Assert.IsArgumentNullException(result, "processRunner");
            }
コード例 #8
0
            public void Should_Throw_If_Arguments_Are_Null()
            {
                // Given
                var fixture = new CakeContextFixture();

                fixture.Arguments = null;

                // When
                var result = Record.Exception(() => fixture.CreateContext());

                // Then
                Assert.IsArgumentNullException(result, "arguments");
            }
コード例 #9
0
            public void Should_Throw_If_Environment_Is_Null()
            {
                // Given
                var fixture = new CakeContextFixture();

                fixture.Environment = null;

                // When
                var result = Record.Exception(() => fixture.CreateContext());

                // Then
                Assert.IsArgumentNullException(result, "environment");
            }
コード例 #10
0
            public void Should_Throw_If_File_System_Is_Null()
            {
                // Given
                var fixture = new CakeContextFixture();

                fixture.FileSystem = null;

                // When
                var result = Record.Exception(() => fixture.CreateContext());

                // Then
                Assert.IsArgumentNullException(result, "fileSystem");
            }
コード例 #11
0
ファイル: CakeContextTests.cs プロジェクト: stgwilli/cake
            public void Should_Throw_If_Resolver_Could_Not_Be_Found()
            {
                // Given
                var fixture = new CakeContextFixture();
                var context = fixture.CreateContext();

                // When
                var result = Record.Exception(() => context.GetToolResolver("Foo"));

                // Then
                Assert.IsType <CakeException>(result);
                Assert.Equal("Failed to resolve tool: Foo", result.Message);
            }
コード例 #12
0
ファイル: CakeContextTests.cs プロジェクト: zokiz/cake
            public void Should_Throw_If_Log_Is_Null()
            {
                // Given
                var fixture = new CakeContextFixture();

                fixture.Log = null;

                // When
                var result = Record.Exception(() => fixture.CreateContext());

                // Then
                AssertEx.IsArgumentNullException(result, "log");
            }
コード例 #13
0
ファイル: CakeContextTests.cs プロジェクト: stgwilli/cake
            public void Should_Find_Tool_By_Name_Regardless_Of_Casing(string name)
            {
                // Given
                var fixture  = new CakeContextFixture();
                var resolver = Substitute.For <IToolResolver>();

                resolver.Name.Returns("Foo");
                fixture.ToolResolvers.Add(resolver);
                var context = fixture.CreateContext();

                // When
                var result = context.GetToolResolver(name);

                // Then
                Assert.Equal(resolver, result);
            }