コード例 #1
0
        public async void LunchRepository_CreateUserAsync_ReturnsId()
        {
            // arrange
            LunchContext    context = GetContext();
            LunchRepository target  = new LunchRepository(context);

            string googleId = "googleId";
            string email    = "*****@*****.**";
            string name     = "goodname";
            string photoUrl = "photo";

            // act
            var result = await target.CreateUserAsync(googleId, email, name, photoUrl);

            // assert
            UserEntity newUser = context.Users.Where(u => u.Name == name).FirstOrDefault();

            Assert.Equal(newUser.Id, result.Id);
        }
コード例 #2
0
        public async void LunchRepository_CreateUserAsync_AddsEntryToTable()
        {
            // arrange
            LunchContext    context = GetContext();
            LunchRepository target  = new LunchRepository(context);

            string googleId = "googleId";
            string email    = "*****@*****.**";
            string name     = "goodname";
            string photoUrl = "photo";

            // act
            await target.CreateUserAsync(googleId, email, name, photoUrl);

            // assert
            UserEntity newUser = context.Users.Where(u => u.GoogleId == googleId).FirstOrDefault();

            Assert.True(newUser.Id > 0);
            Assert.Equal(email, newUser.Email);
            Assert.Equal(name, newUser.Name);
        }