public void TestCreateData() { var provider = new SQLiteDataAccessProvider(); var connectionString = @"Data Source=Data\DB\Entities.sqlite"; var db = new EntitiesDb(provider, connectionString, "Watsonia.Data.TestDataBuilder.Tests.Entities"); TestData.Import(db); // Make sure everything's been created Assert.AreEqual(2, db.Query <Organisation>().Count()); Assert.AreEqual(4, db.Query <Employee>().Count()); // Make sure that employees have the right organisations Assert.AreEqual("ABC", db.Query <Employee>().First(e => e.Name == "Ron").Organisation.Code); Assert.AreEqual("ABC", db.Query <Employee>().First(e => e.Name == "Darren").Organisation.Code); Assert.AreEqual("XYZ", db.Query <Employee>().First(e => e.Name == "Lisa").Organisation.Code); Assert.AreEqual("XYZ", db.Query <Employee>().First(e => e.Name == "Marie").Organisation.Code); }
public async Task TestCreateUser() { var provider = new SQLiteDataAccessProvider(); var connectionString = @"Data Source=Data\Entities.sqlite"; var db = new EntitiesDb(provider, connectionString, "Watsonia.Data.Identity.Tests.Entities"); db.EnsureDatabaseDeleted(); db.EnsureDatabaseCreated(); var store = new UserStore <User, UserRole, NoLogins, NoClaims, long>(db); var user = db.Create <User>(); user.Email = "*****@*****.**"; user.UserName = "******"; var result = await store.CreateAsync(user, new CancellationToken()); Assert.AreEqual(true, result.Succeeded); Assert.IsTrue(db.Query <User>().Any(u => u.Email == "*****@*****.**")); }