Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: useSystemNetMailSettings=false still uses .config settings + feature: PickupDirectoryLocation from nlog.config #939

Merged
merged 8 commits into from
Oct 18, 2015

Conversation

dnlgmzddr
Copy link

Address bug/690, the PickUpDirectory location is exposed in the Mail Target.

However given that the test are using a mock-up for the SMTP class it does not make a lot of sense to create a test for this bug.

@304NotModified the documentation of this property is still pending. I will check the documentation project.

Daniel Gómez Didier added 3 commits October 4, 2015 09:52
Change require parameter check.
Override "pickupdirectorylocation settings and expose it as a parameter.
@304NotModified
Copy link
Member

@dnlgmzddr looks good. Can we unit test this?

The documentation is just editing the wiki.

@dnlgmzddr
Copy link
Author

@304NotModified, I'm not sure how to unit test, this feature. However the test cases, are quite simple (all involving useSystemNetMailSettings=false):

  • If PickUpDirectory is set; the EML file must end up in the directory.
  • If PickUpDirectory and smtpServer are null; it must fail.

Never the less, I don't know how to test the first scenario, and the other one is already being partially tested in the existing tests.

@304NotModified
Copy link
Member

The unit test should test "useSystemNetMailSettings=false", so if "useSystemNetMailSettings=false", then I should not use the values of the web.config. Just check the values of the settings.

If PickUpDirectory is set; the EML file must end up in the directory.
If PickUpDirectory and smtpServer are null; it must fail.

Those are not needed, as they test somethings else.

However the test cases, are quite simple

Unit test should be simple :)

@304NotModified 304NotModified changed the title Bugfix/690 Bugfix: useSystemNetMailSettings=false still uses .config settings Oct 5, 2015
@304NotModified
Copy link
Member

Need some help @dnlgmzddr ?

@dnlgmzddr
Copy link
Author

@304NotModified Finally, I do have to adjust the mockups to test the the new scenarios. Let me now if you have any more comments.

{
throw new NLogRuntimeException(string.Format(RequiredPropertyIsEmptyFormat, "SmtpServer"));

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: it's allowed to have one of the two as null, smtp uses Host, pickupdir doesn't use Host

@304NotModified 304NotModified changed the title Bugfix: useSystemNetMailSettings=false still uses .config settings Bugfix: useSystemNetMailSettings=false still uses .config settings + PickupDirectoryLocation from nlog.config Oct 17, 2015
@304NotModified 304NotModified changed the title Bugfix: useSystemNetMailSettings=false still uses .config settings + PickupDirectoryLocation from nlog.config Bugfix: useSystemNetMailSettings=false still uses .config settings + feature: PickupDirectoryLocation from nlog.config Oct 17, 2015
@304NotModified
Copy link
Member

Looks very good! Nice work!

Just two code comments, please check them, I think they are important.

Can you also document ISmtpClient (just copy)? Thanks!

@304NotModified 304NotModified added bug Bug report / Bug fix feature labels Oct 17, 2015
@304NotModified 304NotModified added this to the 4.2 milestone Oct 17, 2015
* Fix validation logic.
* Add new Property  to ISmtpClient, DeliveryMethod
@dnlgmzddr
Copy link
Author

@304NotModified I just upload some changes, and documented ISmtpClient, also I added some inline comments expalining the validation regarding this comments (note: it's allowed to have one ...).

Have a nice Sunday.

client.Host = renderedSmtpServer;

// The network delivery method take precedence if both Host and PickupDirectoryLocation are present.
client.DeliveryMethod = SmtpDeliveryMethod.Network;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@304NotModified should we also expose the DeliveryMethod as part of the MailTarget properties, or can we assume Network when there a Host and SpecifiedPickupDirectory where there not a Host but PickUpDirectoryValue? (should we also consider PickupDirectoryFromIis?)

regarding the other comments, will these kind of check be more appropriate ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we prefer exposing DeliveryMethod, because it's unclear when both are filled. So good idea :)

* Improve validation.
* Add support for DelivereyMethod.PickupDirectoryFromIis
@codecov-io
Copy link

Current coverage is 70.35%

Branch #939 has no coverage reports uploaded yet.

No diff could be generated. No reports for master found.


Uncovered Suggestions

  1. +0.10% via ...oredConsoleTarget.cs#232...244
  2. +0.09% via ...c/NLog/LogFactory.cs#180...191
  3. +0.09% via ...gingConfiguration.cs#333...343
  4. See 7 more...

Powered by Codecov. Updated on successful CI builds.

@304NotModified 304NotModified added the enhancement Improvement on existing feature label Oct 18, 2015
304NotModified added a commit that referenced this pull request Oct 18, 2015
Bugfix: useSystemNetMailSettings=false still uses .config settings + feature: PickupDirectoryLocation from nlog.config
@304NotModified 304NotModified merged commit c1e2e94 into NLog:master Oct 18, 2015
@304NotModified
Copy link
Member

Nice work! Thanks! :)

@304NotModified
Copy link
Member

@dnlgmzddr can you update the wiki?

Just add the two new properties, and add "introduced in NLog 4.2"

https://github.com/NLog/NLog/wiki/Mail-target

  • update wiki

@dnlgmzddr
Copy link
Author

@304NotModified The wiki have been updated.

@304NotModified
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report / Bug fix enhancement Improvement on existing feature feature XSD change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants