HaveIBeenPwned / EmailAddressExtractor

A project to rapidly extract all email addresses from any files in a given path
BSD 3-Clause "New" or "Revised" License
64 stars 23 forks source link

Changed CLI config to non-static #29

Closed GStefanowich closed 1 year ago

GStefanowich commented 1 year ago

All tests will now pass when simultaneously run

Added a "-y" or "--yes" parameter to automatically skip the CONTINUE? prompt Added an I (for Info) keypress to the CONTINUE? prompt which will print all the files that are going to be read Now accepts both short-form and long-form CLI parameters: (-?, -h, --help), (-v, --version), (-o, --output), (-r, --report) Updated the README to reflect these changes

GStefanowich commented 1 year ago

With 163408c2bf2a37eaa14970ec874043f9f87afceb #28 should be fixed. Test methods now use UpperCamel the same as all of the other program methods. I indented the file that was 2-space indented to be the same as the other files, wrapped it in a namespace, and also converted a set of comments into #regions

troyhunt commented 1 year ago

Hmmm... I'm still seeing a bunch of failures here:

image

GStefanowich commented 1 year ago

That's weird @troyhunt - I'm only seeing successes

image

GStefanowich commented 1 year ago

Just to make sure you are on the latest pull?

I used a git reset --hard origin/main to make sure I was on the latest, and I'm still only seeing successes.

I'm a bit confused by the output of your report and how it could get into that state.

Just picking one at random, your Report() is failing, due to "output" != "addresses_output.txt"

Report() is as follows:

public void Report()
{
    // Input string is "AddressExtractor.exe input1 -r report"
    var args = new[] { "input1", "-r", "report" };

    // Gather a set of output files, which will only contain "input1"
    var inputs = new List<string>();

    // Run the CLI config parser, which will access "-r report"
    //     and set the "config.ReportFilePath" to "report"
    var config = new CommandLineProcessor(args, inputs);

    // Input is in fact only size 1, because we passed it "input1"
    Assert.AreEqual(inputs.Count, 1);

    // The 1st (0) value from inputs equals to "input1" from args[0]
    Assert.AreEqual(inputs[0], args[0]);

    // Here the error is occurring, "config.OutputFilePath" remains default value,
    //     because the input does not change it. So "config.OutputFilePath" will
    //     be "addresses_output.txt", and is equal to the default const Defaults.OUTPUT_FILE_PATH
    //     Your error asserts that "config.OutputFilePath" is actually set to "output",
    //     The string "output" is not present anywhere in this method
    Assert.AreEqual(config.OutputFilePath, CommandLineProcessor.Defaults.OUTPUT_FILE_PATH);

    /* ... */
}
troyhunt commented 1 year ago

Huh, now it works. Hard reset might have done it, sorry for the confusion.