Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Unit test class after integrating IPathWrapper with the ReallyHardToTest class
using NUnit.Framework;
using Moq;
public class ReallyHardToTestTests{
Mock<IPathWrapper> mockPathWrapper;
// We will fix this soon...
SomeOtherDependency otherDependency;
ReallyHardToTest systemUnderTest;
public void SetUp(){
mockPathWrapper = new Mock<IPathWrapper>(MockBehavior.Strict);
otherDependency = new SomeOtherDependency();
systemUnderTest = new ReallyHardToTest(otherDependency, 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment