public void BuildCommandIsNotSuccessfulExceptionThrown() { // Arrange var mockCommandFactory = BuildMockCommandFactoryForScenario(false, new string[0], true, new DockerImageResult[0]); var sut = new Dockhand.Client.DockerClient(_workingDirectory, mockCommandFactory); // Act var exception = Assert.CatchAsync(async() => await sut.BuildImageAsync(ExpectedDockerFile, ExpectedTarget, ExpectedRepository, ExpectedTag)); // Assert exception.Should().BeOfType <DockerCommandException>(); }
public async Task BothCommandsAreSuccessfulImageCreated_DockerImageHasCorrectTag() { // Arrange var imageOutput = new[] { new DockerImageResult { Id = ExpectedImageId, Repository = ExpectedRepository, Tag = ExpectedTag } }; var buildOutput = new[] { "buildOutput" }; var mockCommandFactory = BuildMockCommandFactoryForScenario(true, buildOutput, true, imageOutput); var sut = new Dockhand.Client.DockerClient(_workingDirectory, mockCommandFactory); // Act var result = await sut.BuildImageAsync(ExpectedDockerFile, ExpectedTarget, ExpectedRepository, ExpectedTag); // Assert result.Tag.Should().Be(ExpectedTag); }