Ejemplo n.º 1
0
        public void CommitTest()
        {
            var target = new XmlUnitOfWork(fileName);

            target.Entities.Add(new WorkItem());
            target.Commit();

            var exists = File.Exists(fileName);

            Assert.IsTrue(exists, "File was not found.");
        }
Ejemplo n.º 2
0
        public void ReadXmlTest()
        {
            var uow = new XmlUnitOfWork(fileName);
            var x   = new WorkItem {
                Description = "test", Id = 0, State = "test", Title = "test"
            };

            uow.Entities.Add(x);
            uow.Commit();

            var target = new XmlUnitOfWork_Accessor(fileName);

            Assert.AreEqual(1, target.ReadXml().Count());
        }
Ejemplo n.º 3
0
        public void EntitiesTest()
        {
            var uow = new XmlUnitOfWork(fileName);
            var x   = new WorkItem {
                Description = "test", Id = 0, State = "test", Title = "test"
            };

            uow.Entities.Add(x);
            uow.Commit();

            uow = new XmlUnitOfWork(fileName);
            var actual = uow.Entities.FindById(1) as WorkItem;             // 0 is just a placeholder

            Assert.AreEqual(x.Description, actual.Description);
        }