Ejemplo n.º 1
0
        public void TestDeserialization()
        {
            JsonRepository<TestEntity> repo = new JsonRepository<TestEntity>();
            int id = 3;
            TestEntity te = new TestEntity(id);

            string testTitle = "Test Title";
            te.Title = testTitle;

            double testPrice = 7.15;
            te.UnitPrice = testPrice;

            AlbumCategory testCat = AlbumCategory.Pop;
            te.Category = testCat;

            int testQty = 7;
            te.Quantity = testQty;

            DateTime testDate = DateTime.Now.Date;
            te.ReleaseDate = testDate;

            repo.Save(te);

            Album a3 = repo.GetById(id);

            Assert.IsTrue(a3.Title == testTitle);
            Assert.IsTrue(a3.UnitPrice == testPrice);
            Assert.IsTrue(a3.Category == testCat);
            Assert.IsTrue(a3.Quantity == testQty);
            Assert.IsTrue(a3.ReleaseDate == testDate);

            Directory.Delete(repo.FolderPath, true);
        }
Ejemplo n.º 2
0
        public void TestGetById()
        {
            JsonRepository <TestEntity> repo = new JsonRepository <TestEntity>();
            int        id = 3;
            TestEntity te = new TestEntity(id);

            repo.Save(te);

            Album a3 = repo.GetById(id);

            Assert.IsNotNull(a3);

            Directory.Delete(repo.FolderPath, true);
        }
Ejemplo n.º 3
0
        public void TestDeserialization()
        {
            JsonRepository <TestEntity> repo = new JsonRepository <TestEntity>();
            int        id = 3;
            TestEntity te = new TestEntity(id);

            string testTitle = "Test Title";

            te.Title = testTitle;

            double testPrice = 7.15;

            te.UnitPrice = testPrice;

            AlbumCategory testCat = AlbumCategory.Pop;

            te.Category = testCat;

            int testQty = 7;

            te.Quantity = testQty;

            DateTime testDate = DateTime.Now.Date;

            te.ReleaseDate = testDate;

            repo.Save(te);

            Album a3 = repo.GetById(id);

            Assert.IsTrue(a3.Title == testTitle);
            Assert.IsTrue(a3.UnitPrice == testPrice);
            Assert.IsTrue(a3.Category == testCat);
            Assert.IsTrue(a3.Quantity == testQty);
            Assert.IsTrue(a3.ReleaseDate == testDate);

            Directory.Delete(repo.FolderPath, true);
        }
Ejemplo n.º 4
0
        public void TestGetById()
        {
            JsonRepository<TestEntity> repo = new JsonRepository<TestEntity>();
            int id = 3;
            TestEntity te = new TestEntity(id);
            repo.Save(te);

            Album a3 = repo.GetById(id);
            Assert.IsNotNull(a3);

            Directory.Delete(repo.FolderPath, true);
        }