Note that there are some explanatory texts on larger screens.

plurals
  1. POBuilding and loading file in NUnit
    text
    copied!<p>I am following a book called "The Art of Unit Testing". I have reached a point where I need to test my test method that I have writtent using NUNit. The author instructs to build the project and then locate the path to the assembly file that was built and give the path to NUnit for testing. </p> <p>My problem is that I cant seem to get this Assembly file path. Where is it located? </p> <p>Plus, when I run my code, I am getting the following error: </p> <pre><code> Error 2 Program 'c:\Users\Documents\Visual Studio 2012\Projects\Loganalyzer\Loganalyzer\obj\Debug\Loganalyzer.exe' does not contain a static 'Main' method suitable for an entry point c:\users\documents\visual studio 2012\Projects\Loganalyzer\Loganalyzer\CSC Loganalyzer </code></pre> <p>Here's my code: </p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Loganalyzer { public class LogAnalyzer { public bool IsValidLogFileName(string fileName) { if (!fileName.EndsWith(".SLF")) { return false; } return true; } } } </code></pre> <p>I am following the exact example that's in the book but cant get it to work as you can see. I will appreciate your help folks. </p> <pre><code>using Loganalyzer; using NUnit.Framework; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LogAnalyzerTest { [TestFixture] class LogAnalyzerTest { [Test] public void IsValidFileName_validFile_ReturnsTrue() { //Arrange ( Arranges objects, creating and setting them up as necessary). LogAnalyzer analyzer = new LogAnalyzer(); //Act bool result = analyzer.IsValidLogFileName("whatever.SLF"); //Assert ( Asserts that something is as expected) Assert.IsTrue(result, "file name should be valid"); } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload