Fix tests, like the TODO said

This commit is contained in:
Matt Nadareski
2020-05-06 17:00:34 -07:00
parent 9a3c2eb626
commit 0efecd6601
3 changed files with 10 additions and 21 deletions

View File

@@ -6,7 +6,7 @@ namespace DICUI.Data
{
public class Options : IDictionary<string, string>
{
private Dictionary<string, string> _settings = new Dictionary<string, string>();
private Dictionary<string, string> _settings;
#region Internal Program
@@ -181,7 +181,7 @@ namespace DICUI.Data
/// <param name="settings"></param>
public Options(Dictionary<string, string> settings = null)
{
this._settings = settings;
this._settings = settings ?? new Dictionary<string, string>();
}
/// <summary>

View File

@@ -141,12 +141,6 @@ namespace DICUI.Utilities
#endregion
/// <summary>
/// Empty constructor for testing only
/// </summary>
/// TODO: Remove this and fix tests
public DumpEnvironment() { }
/// <summary>
/// Constructor for a full DumpEnvironment object from user information
/// </summary>

View File

@@ -16,14 +16,12 @@ namespace DICUI.Test
[InlineData("stop D", 'D', false, MediaType.DVD, true)]
public void ParametersValidTest(string parameters, char letter, bool isFloppy, MediaType? mediaType, bool expected)
{
var env = new DumpEnvironment
{
Parameters = new DiscImageCreator.Parameters(parameters),
Drive = isFloppy
? new Drive(InternalDriveType.Floppy, new DriveInfo(letter.ToString()))
: new Drive(InternalDriveType.Optical, new DriveInfo(letter.ToString())),
Type = mediaType,
};
var options = new Options() { InternalProgram = "dic" };
var drive = isFloppy
? new Drive(InternalDriveType.Floppy, new DriveInfo(letter.ToString()))
: new Drive(InternalDriveType.Optical, new DriveInfo(letter.ToString()));
var env = new DumpEnvironment(options, string.Empty, string.Empty, drive, KnownSystem.IBMPCCompatible, mediaType, parameters);
bool actual = env.ParametersValid();
Assert.Equal(expected, actual);
@@ -40,11 +38,8 @@ namespace DICUI.Test
[InlineData("superhero", "blah&foo.bin", "superhero", "blah&foo.bin")]
public void FixOutputPathsTest(string outputDirectory, string outputFilename, string expectedOutputDirectory, string expectedOutputFilename)
{
var env = new DumpEnvironment
{
OutputDirectory = outputDirectory,
OutputFilename = outputFilename,
};
var options = new Options() { InternalProgram = "dic" };
var env = new DumpEnvironment(options, outputDirectory, outputFilename, null, KnownSystem.IBMPCCompatible, MediaType.CDROM, string.Empty);
env.FixOutputPaths();
Assert.Equal(expectedOutputDirectory, env.OutputDirectory);