Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
.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