public void MvvX_CBLite_ExistingViewTests() { testContext.DeployDirectory(@"Ressources\nosqltestcbldb.cblite2", @"ExistingRepo\nosqltestcbldb.cblite2"); var existingRepoManager = new CouchBaseLite(); existingRepoManager.Initialize(Path.Combine(NoSQLCoreUnitTests.testContext.DeploymentDirectory, "ExistingRepo")); entityRepo = new CouchBaseLiteRepository <TestEntity>(existingRepoManager, dbName); MvvX_CBLite_CreateViews(entityRepo); var res3 = entityRepo.GetAll(); Assert.AreEqual(4, res3.Count, "Existing view TestEntity contains 5 docs"); var res1 = entityRepo.GetByField <int>(nameof(TestEntity.NumberOfChildenInt), 0); Assert.AreEqual(2, res1.Count, "Existing view TestEntity-NumberOfChildenInt contains 2 docs"); var res2 = entityRepo.GetByField <string>(nameof(TestEntity.Cities), "Andernos"); Assert.AreEqual(1, res2.Count, "Existing view TestEntity-Cities contains 1 docs"); var entity6 = new TestEntity { Id = "6", Birthday = new DateTime(1985, 08, 12, 0, 0, 0, DateTimeKind.Utc), IsAMan = true, Name = "Balan", PoidsFloat = 70.15F, PoidsDouble = 70.15, NumberOfChildenInt = 0, NumberOfChildenLong = 9999999999999999 }; entityRepo.InsertOne(entity6); var res4 = entityRepo.GetByField <int>(nameof(TestEntity.NumberOfChildenInt), 0); Assert.AreEqual(3, res4.Count, "Existing view TestEntity-NumberOfChildenInt contains 5 docs"); var res5 = entityRepo.GetByField <string>(nameof(TestEntity.Cities), "Andernos"); Assert.AreEqual(1, res5.Count, "Existing view TestEntity-Cities contains 1 docs"); var res6 = entityRepo.GetAll(); Assert.AreEqual(5, res6.Count, "Existing view TestEntity contains 5 docs"); }
protected override void AdditionalSetup() { base.AdditionalSetup(); var fileStore = new MvxWpfFileStore(NoSQLCoreUnitTests.testContext.DeploymentDirectory + "\\"); Ioc.RegisterSingleton <IMvxFileStore>(fileStore); Ioc.RegisterSingleton <ICouchBaseLite>( () => { var cbl = new CouchBaseLite(); cbl.Initialize(NoSQLCoreUnitTests.testContext.DeploymentDirectory + "\\DB"); return(cbl); } ); }
public void MvvX_CBLite_NewBaseTests() { var dbFolderPath = Path.Combine(NoSQLCoreUnitTests.testContext.DeploymentDirectory, "DB2"); var fileStore = new MvxWpfFileStore(dbFolderPath); // Ensure that the db file doesn't exists if (fileStore.FolderExists(dbFolderPath)) { fileStore.DeleteFolder(dbFolderPath, true); } var cbl = new CouchBaseLite(); cbl.Initialize(dbFolderPath); // Create a new db (the db file is missing) entityRepo = new CouchBaseLiteRepository <TestEntity>(CouchBaseLiteLiteManager, "DB2"); Assert.AreEqual(false, entityRepo.Exist("123456")); }