Suppose my service is runing and i have used a code for sending email notification in that service. The "EmailNotification" method is async and await.
Code of EmailNotification:
public async task EmailNotification()
{
try
{
//code here
using (SmtpClient smtp = new SmtpClient())
{
//mail sending
await smtp.Send(mailMessage);
}
}
Catch(Exception ex)
{
}
}
Used EmailNotification methos in my some test method like that:
public void test()
{
EmailNotification();
}
My Problem:
1)How can i log execptions of async and await method if my destination method test is not of type async?
2)Is it possible to use async method in non async type like above ia m using in test method?