Skip to content

Instantly share code, notes, and snippets.

@AlphaGit
Created March 21, 2016 00:32
Show Gist options
  • Save AlphaGit/0a9f0fcfc2a947e8a481 to your computer and use it in GitHub Desktop.
Save AlphaGit/0a9f0fcfc2a947e8a481 to your computer and use it in GitHub Desktop.
Coupled consumer Fakes Aseembly tests
using ClassDependencyTest.Example.Coupled;
using ClassDependencyTest.Example.Coupled.Fakes;
using Microsoft.QualityTools.Testing.Fakes;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ClassDependencyTestTests.Example.Coupled
{
[TestClass]
public class ConsumerTests
{
[TestMethod]
public void DoConsumptionTest()
{
using (ShimsContext.Create())
{
ShimProducer.AllInstances.DoProduction = _self => new object();
var consumer = new Consumer();
Assert.IsTrue(consumer.DoConsumption());
}
}
[TestMethod]
public void DoConsumptionTest_OnNull()
{
using (ShimsContext.Create())
{
ShimProducer.AllInstances.DoProduction = _self => null;
var consumer = new Consumer();
Assert.IsFalse(consumer.DoConsumption());
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment