Skip to content

Instantly share code, notes, and snippets.

@efleming969
Last active June 13, 2018 11:02
Show Gist options
  • Save efleming969/c3533416563221612047e1f3d965f548 to your computer and use it in GitHub Desktop.
Save efleming969/c3533416563221612047e1f3d965f548 to your computer and use it in GitHub Desktop.
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
[TestClass]
public class StubbingTests
{
[TestMethod]
public void should_build_a_greeting_based_on_age()
{
var stubMessageService = new Mock<IMessageService>();
stubMessageService.Setup(ds => ds.GetMessageBasedOnAge(45)).Returns("Whazzup");
GreetingBuilder2 sut = new GreetingBuilder2(stubMessageService.Object);
string result = sut.Build("Joe", 45);
Assert.AreEqual("Whazzup, Joe!", result);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment