Skip to content

Instantly share code, notes, and snippets.

@ifew
Created July 5, 2018 16:48
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ifew/372ecee0dedd227d00e2b368820bda4f to your computer and use it in GitHub Desktop.
.Net Core 2 Fake
public void Display_Username_Shold_Be_iFew()
{
var _options = new DbContextOptionsBuilder<MemberContext>().UseInMemoryDatabase("get_by_id_members").Options;
var _context = new MemberContext(_options);
_context.Members.Add(
new MemberModel
{
Id = 1,
Fullname = "iFew",
Card_no = "6425880473",
Birthday = new DateTime(1987, 01, 01),
Mobilephone = "0912345678"
});
_context.SaveChanges();
MemberService _memberService = new MemberService(_context);
MemberModel actual = _memberService.Get_Member_Information_By_ID("1");
Assert.Equal(1, actual.Id);
Assert.Equal("iFew", actual.Fullname);
Assert.Equal("6425880473", actual.Card_no);
Assert.Equal(new DateTime(1987, 01, 01), actual.Birthday);
Assert.Equal("0912345678", actual.Mobilephone);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment