public void GetUserBySub() { var user = new User() { UserId = 4, Username = "******", Auth0 = "Stuff" }; var result1 = new User(); var result2 = new User(); using (var context = new InTheKitchenDBContext(testOptions)) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); context.Add(user); context.SaveChanges(); result2 = context.Users.FirstOrDefault(u => u.Auth0 == user.Auth0); } using (var context = new InTheKitchenDBContext(testOptions)) { context.Database.EnsureCreated(); var msr = new KitchenRepository(context); result1 = msr.GetUserDataBySub(user.Auth0); } Assert.Equal(result1.Username, result2.Username); }
public AuthModel GetCurrentUserData(string sub) { return(AuthModel.GetFromUser(_repo.GetUserDataBySub(sub))); }