title: Unit Test - How to test a `void` method that just inserts a log message (Serilog)
body: <p>I need to test a method of type <code>void</code>, it just inserts a message on my LOG variable using a LOG framework (<a href="https://serilog.net/" rel="noreferrer">Serilog</a>).</p>
  
  <p>See the implementation example:</p>
  
  <pre><code>public class MyClass
  {
      public MyClass(ILogger&lt;IProcess&gt; logger)
      {
          this.logger = logger;
      }
  
      private readonly ILogger logger;
  
      //...Anothers methods...
  
      public void LogInit(Guid processId, string folder, string[] args)
      {
          var myObject = new
          {
              ProcessId = processId,
              Folder = folder,
              Arguments = args
          };
  
          this.logger.LogWarning("{@myObject}", myObject);
      }
  }
  </code></pre>
  
  <p>In this scenario, we would need to create a test for the <code>LogInit (...)</code></p>
  
  <p>Does this method really need to be tested? Or rather, does it make sense for it to exist?</p>
  
  <p>I was reading something about:</p>
  
  <blockquote>
    <p>"If your method has no side effects, and doesn’t return anything, then it’s not doing anything."</p>
  </blockquote>
  
  <p>In this case, the method was only created "separately" to maintain the organization of the code and separate the responsibilities of the class a bit more.</p>
  
  <p>That makes sense?</p>
  
  <p><strong>EDIT:</strong> @PeterBons</p>
  
  <p>We do not have access to the messages registered in the Interface  (<code>logger</code>), like: <code>this.logger.GiveMeWarningLogs()</code>...</p>