Skip to content

Instantly share code, notes, and snippets.

@francipvb
Last active September 28, 2019 16:53
Show Gist options
  • Save francipvb/8fa271ed1256a14c610b4af3ab0c3e3d to your computer and use it in GitHub Desktop.
Save francipvb/8fa271ed1256a14c610b4af3ab0c3e3d to your computer and use it in GitHub Desktop.
Just a little Moq demonstration
using Moq;
using Xunit;
namespace GithubGists
{
public class MockGist
{
[Fact]
public void TestMock()
{
// Note this conditional expression...
var foo = Mock.Of<IFoo>(f => f.Foo == "foo");
Assert.Equal("foo", foo.Foo);
}
}
public interface IFoo
{
string Foo { get; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment