コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: UserLogic.cs プロジェクト: Anis1988/P2_2ManyCooks
 public AuthModel GetCurrentUserData(string sub)
 {
     return(AuthModel.GetFromUser(_repo.GetUserDataBySub(sub)));
 }