Skip to content

Instantly share code, notes, and snippets.

@ifew
Created July 5, 2018 09:48
Show Gist options
  • Save ifew/cd60ca3e959184353e3868a8ddd9c3ab to your computer and use it in GitHub Desktop.
Save ifew/cd60ca3e959184353e3868a8ddd9c3ab to your computer and use it in GitHub Desktop.
.Net Core 2 Spy Test
using System;
using Xunit;
namespace member_spy
{
public class MemberTest
{
[Fact]
public void When_Member_Access_to_Profile() {
SpyAuthorize spy = new SpyAuthorize();
Member member1 = new Member(spy);
Member member2 = new Member(spy);
string is_authorized = member1.Profile();
Assert.Equal(2, spy.checkAuthorizeWasCalled);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment