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; }
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; }
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; }
public void DBを一旦クリアする() { using (var entities = new Model.FlowerEntities()) { foreach (var file in entities.Files) { entities.Files.Remove(file); } entities.SaveChanges(); } return; }
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); }
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; }