public void DeleteLogTest() { using (var ds = CreateDataStore(1, 1)) { var tree = ds.From <Tree>().Read().FirstOrDefault(); tree.Stratum.Should().NotBeNull(); tree.CuttingUnit.Should().NotBeNull(); var logDs = new ILogDataService(tree, null, ds); logDs.Logs.Should().HaveCount(1); logDs.AddLogRec(); foreach (var log in logDs.Logs.ToArray()) { logDs.DeleteLog(log); tree.LogCountDirty.Should().BeTrue(); } logDs.Logs.Should().BeEmpty(); logDs.Invoking(lds => lds.Save()).Should().NotThrow(); ds.GetRowCount("Log", $"WHERE Tree_CN = {tree.Tree_CN}"); } }
public void AddLogTest() { using (var ds = CreateDataStore(1, 0)) { var tree = ds.From <Tree>().Read().FirstOrDefault(); tree.Stratum.Should().NotBeNull(); tree.CuttingUnit.Should().NotBeNull(); var logDs = new ILogDataService(tree, null, ds); logDs.Logs.Should().BeEmpty(); //add log var log = logDs.AddLogRec(); ValidateLog(log); logDs.Logs.Should().Contain(log); var log2 = logDs.AddLogRec(); log2.LogNumber.Should().BeGreaterThan(log.LogNumber); logDs.Logs.Should().Contain(log2); logDs.Invoking(lds => lds.Save()).Should().NotThrow(); } }