示例#1
0
        public void ファイルDB登録()
        {
            var domain = new FileDomain(@".\TestCase\FileStore\");

            var file = domain.Regist2DB("Test_Text.txt", "TestId");

            Assert.True(file != null);
            using (var entities = new Model.FlowerEntities())
            {
                var latestileId = (from e in entities.Files.AsEnumerable() select e.ID).Max();
                Assert.True(file.ID == latestileId);
            }
            return;
        }
示例#2
0
        public void ファイルDB登録_連続登録()
        {
            var domain = new FileDomain(@".\TestCase\FileStore\");

            var file = domain.Regist2DB("Test_Text.txt", "TestId01");
                file = domain.Regist2DB("Test_Text.txt", "TestId02");

            Assert.True(file != null);
            using (var entities = new Model.FlowerEntities())
            {
                var cnt = (from e in entities.Files.AsEnumerable() where e.Name == "Test_Text.txt" select e).Count();
                Assert.True(cnt == 2);
            }
            return;
        }
示例#3
0
        public void ファイル削除DB()
        {
            var domain = new FileDomain(@".\TestCase\FileStore\");
            var newId = domain.Regist(@"TestCase\Data\Test_Text.txt");

            var cn = new EntityConnection("name=FlowerEntities");
            cn.Open();

            domain.removeFromDB(newId, cn);
            using (var entities = new Model.FlowerEntities())
            {
                Assert.True(entities.Files.Count() == 0);
            }
            return;
        }
示例#4
0
 public void DBを一旦クリアする()
 {
     using (var entities = new Model.FlowerEntities())
     {
         foreach (var file in entities.Files)
         {
             entities.Files.Remove(file);
         }
         entities.SaveChanges();
     }
     return;
 }
示例#5
0
        public void ファイル登録_連続()
        {
            var domain = new FileDomain(@".\TestCase\FileStore\");

            domain.Regist(@"TestCase\Data\Test_Text.txt");
            domain.Regist(@"TestCase\Data\Test_Text.txt");
            using (var entities = new Model.FlowerEntities())
            {
                var latestFileId = (from e in entities.Files.AsEnumerable() select e.ID).Max();
                Assert.True(latestFileId == "2");
            }
            Assert.True(System.IO.File.Exists(@".\TestCase\FileStore\1.dat") == true);
            Assert.True(System.IO.File.Exists(@".\TestCase\FileStore\2.dat") == true);
        }
示例#6
0
        public void ファイル削除_1つ()
        {
            var domain = new FileDomain(@".\TestCase\FileStore\");
            var newId = domain.Regist(@"TestCase\Data\Test_Text.txt");

               var file =  domain.Remove(newId);

            Assert.True(System.IO.File.Exists(@".\TestCase\FileStore\1.dat") == false);
            using (var entities = new Model.FlowerEntities())
            {
                Assert.True(entities.Files.Count() == 0);
            }

            Assert.True(file.ID == "1");
            return;
        }