public void GetUsersReturnsUsers() { using (var sqliteWrapper = new SqliteWrapper()) { using (var context = sqliteWrapper.GetContext()) { context.Users.Add(new User { Username = "******" }); context.Users.Add(new User { Username = "******" }); context.Users.Add(new User { Username = "******" }); context.SaveChanges(); } IEnumerable <User> users; using (var context = sqliteWrapper.GetContext()) { var userService = new UserRepository(context); users = userService.GetUsers(); } Assert.AreEqual(3, users.Count()); } }
public void GetUserGuidReturnsUser() { var guid = System.Guid.NewGuid(); using (var sqliteWrapper = new SqliteWrapper()) { using (var context = sqliteWrapper.GetContext()) { context.Users.Add(new User { Guid = guid, Username = "******" }); context.SaveChanges(); } User user; using (var context = sqliteWrapper.GetContext()) { var userService = new UserRepository(context); user = userService.GetUser(guid); } Assert.AreEqual(guid, user.Guid); } }
public void GetUserUsernamePasswordReturnsUser() { using (var sqliteWrapper = new SqliteWrapper()) { using (var context = sqliteWrapper.GetContext()) { context.Users.Add(new User { Username = "******", Password = "******" }); context.SaveChanges(); } User user; using (var context = sqliteWrapper.GetContext()) { var userService = new UserRepository(context); user = userService.GetUser("test", "password"); } Assert.AreEqual("test", user.Username); } }