예제 #1
0
        public void RepoShouldBeQueryable()
        {
            DaoRepository repo = GetTestDaoRepository();

            repo.EnsureDaoAssemblyAndSchema();

            House one = new House {
                Name = "Get This One"
            };
            House two = new House {
                Name = "Get This Too"
            };
            House three = new House {
                Name = "Not this one"
            };

            repo.Save(one);
            repo.Save(three);
            repo.Save(two);

            House[] houses = repo.Query <House>(Query.Where("Name").StartsWith("Get")).ToArray();
            Expect.AreEqual(2, houses.Length);
            houses.Each(house =>
            {
                repo.Delete(house);
            });
            repo.Delete(three);
        }
예제 #2
0
        protected override bool PerformDelete(Type type, object toDelete)
        {
            bool result = DaoRepository.Delete(type, toDelete);

            if (result)
            {
                result = YamlDataDirectory.Delete(type, toDelete);
            }
            return(result);
        }
예제 #3
0
        public override bool Delete <T>(T toDelete)
        {
            bool result = DaoRepository.Delete <T>(toDelete);

            if (result)
            {
                result = YamlDataDirectory.Delete <T>(toDelete);
            }
            return(result);
        }
예제 #4
0
        public void RepositoryDeleteShouldDelete()
        {
            DaoRepository repo     = GetTestDaoRepository();
            TestContainer toDelete = new TestContainer();
            string        testName = "Test Name".RandomLetters(5);

            toDelete.Name     = testName;
            toDelete.BirthDay = DateTime.Now.Subtract(new TimeSpan(7, 0, 0, 0));
            toDelete          = repo.Create(toDelete);
            Expect.IsTrue(repo.Delete <TestContainer>(toDelete));
            TestContainer check = repo.Retrieve <TestContainer>(toDelete.Id);

            Expect.IsNull(check);
        }