Adding System.Drawing.Printing PrintDocument tests. #22868
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great overall. Thanks again for the contribution! I left one minor comment.
[InlineData("newDocument")] | ||
public void DocumentName_SetValue_ReturnsExpected(string documentName) | ||
{ | ||
if (documentName == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really understand what this is doing -- we already essentially test string.Empty
with the second InlineData
. We can probably just remove the null
test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I was thinking about something else when I wrote this lol. I probably should write the null case in separate test to assert that if document name is set to null it will return empty string ...
Also, many tests need to be disabled on Unix, and they all need to be made ConditionTheory/Fact's as usual. |
… Letter. And skipping tests that fail on Unix.
{ | ||
public class PrintDocumentTests | ||
{ | ||
private static bool AnyInstalledPrinters => PrinterSettings.InstalledPrinters.Count == 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry that I didn't mention this before. This same property is present in PageSettingsTests.cs. Can we move it to Helpers.cs and share it like Helpers.GdiplusIsAvailable
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
…Helpers.cs and updating test attributes.
Thanks for consolidating that helper. Looks good to me. |
) * Adding System.Drawing.Printing PrintDocument tests. (dotnet/corefx#20711) * Disabling some tests on Unix and making some Facts/Theories conditional. * Fix tests conditional attributes. * Fix tests conditional attributes. * Adding missed test attributes. * Fixing test attributes. * Changing Assertion in AssertDefaultPageSettings() to expect PaperKind Letter. And skipping tests that fail on Unix. * Updating PageSettings.PrintableArea assertions. * Moving the check for PrinterSettings.InstalledPrinters.Count == 0 to Helpers.cs and updating test attributes. Commit migrated from dotnet/corefx@f5feab3
Adding System.Drawing.Printing PrintDocument tests. (#20711)