Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
using NUnit.Framework;
using Moq;
public class ReallyHardToTestTests{
Mock<IPathWrapper> mockPathWrapper;
Mock<ISomeOtherDependency> mockSomeOtherDependency;
ReallyHardToTest systemUnderTest;
public void SetUp(){
mockPathWrapper = new Mock<IPathWrapper>(MockBehavior.Strict);
mockSomeOtherDependency = new Mock<ISomeOtherDependency>(MockBehavior.Strict);
systemUnderTest = new ReallyHardToTest(mockSomeOtherDependency.Object, mockPathWrapper.Object);
[TestCase(@"c:\some\path\filename.txt", "filename.txt")]
[TestCase(@"c:\some\really\long\path\otherFile.txt", "otherFile.txt")]
public void SetFilename_Always_InvokesPathGetFileName(string input, string expectedFilename){
// Configure our mock expectations
// Exercise our method under test
// Verify that our mock's expectations were met
public void Constructor_Always_PerformsExpectedWork(){
// We're testing the constructor, so no Arrange step here.
// Likewise with Act - creating our SystemUnderTest is the
// Act we're testing here.
// Verify that our expectation was met.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.