private void CheckParameterSetting(Action <BitDifferSettings> settingsChange, string expectedArgument, bool shouldContainArgument) { // Arrange var settings = new BitDifferSettings { CurrentAssemblyFile = _CURRENT, PreviousAssemblyFile = _PREVIOUS }; settingsChange(settings); // Configure settings for test var sut = new BitDifferFixture { Settings = settings }; // Act Testing.Fixtures.ToolFixtureResult result = sut.Run(); // Assert if (shouldContainArgument) { result.Args.Should().ContainEquivalentOf(expectedArgument); } else { result.Args.Should().NotContainEquivalentOf(expectedArgument); } }
public void NoSettings_Throws() { // Arrange var sut = new BitDifferFixture { Settings = null }; // Act var sutAction = new Action(() => sut.Run()); // Assert sutAction.Should().ThrowExactly <ArgumentNullException>() .Which.ParamName.Should().Be("settings"); }
public void NoCurrentAssemblyFileName_Throws(string assemblyFile) { // Arrange var settings = new BitDifferSettings { CurrentAssemblyFile = assemblyFile, PreviousAssemblyFile = _PREVIOUS }; var sut = new BitDifferFixture { Settings = settings }; // Act var sutAction = new Action(() => sut.Run()); // Assert sutAction.Should().ThrowExactly <ArgumentException>() .Which.ParamName.Should().Be(nameof(BitDifferSettings.CurrentAssemblyFile)); }
public void AssemblyFilesSetAsParameters() { // Arrange var settings = new BitDifferSettings { CurrentAssemblyFile = _CURRENT, PreviousAssemblyFile = _PREVIOUS }; var sut = new BitDifferFixture { Settings = settings }; // Act Testing.Fixtures.ToolFixtureResult result = sut.Run(); // Assert result.Args.Should() .EndWith( "\"/Working/TestFiles/Version1/Cake.BitDiffer.TestAssembly.dll\" \"/Working/TestFiles/Version2/Cake.BitDiffer.TestAssembly.dll\""); }