Пример #1
0
        public async Task UserAddTestAsync()
        {
            /// ARRANGE

            // setup PilotRepo to be tested
            var repo = new Repo(_db);
            // setup pilot with name, email, aircraft and a password
            var user = new Admin {
                UserId     = Guid.NewGuid(), FirstName = UnitTestUtil.getRandomString(8),
                LastName   = UnitTestUtil.getRandomString(8), EndlasEmail = UnitTestUtil.getRandomString(8) + "@endlas.com",
                AuthString = UnitTestUtil.getRandomString(8)
            };

            /// ACT
            // call the method to be tested
            await repo.AddAdmin(user);

            var result = await(_db.Users.Where(p => p.EndlasEmail == user.EndlasEmail).FirstOrDefaultAsync());

            /// ASSERT
            Assert.IsNotNull(result);
            Assert.AreEqual(result.EndlasEmail, user.EndlasEmail);
        }