public void ReadLogsTest()
        {
            using (var ds = new CruiseDAL.DAL(readTestFile))
            {
                var wp            = Mock.Of <WindowPresenter>();
                var appController = Mock.Of <ApplicationControllerBase>();
                var target        = new DataEditorView(wp, appController);

                var cu = new CuttingUnitDO()
                {
                    rowID = 1
                };
                var st = new StratumDO()
                {
                    rowID = 1
                };
                var sg = new SampleGroupDO()
                {
                    rowID = 1
                };
                var tdv = new TreeDefaultValueDO()
                {
                    rowID = 1
                };

                var logs = target.ReadLogs(cu, st, sg, tdv, false);

                logs.Should().NotBeNullOrEmpty();
            }
        }
Beispiel #2
0
        public void InflateTest()
        {
            using (var dataStore = new CruiseDAL.DAL())
            {
                dataStore.Insert(new CuttingUnit()
                {
                    Code = "01", CuttingUnit_CN = 1
                });
                dataStore.Insert(new Stratum()
                {
                    Code = "01", Method = "", Stratum_CN = 1
                });
                dataStore.Insert(new SampleGroup()
                {
                    Code = "01", CutLeave = "", UOM = "", Stratum_CN = 1, SampleGroup_CN = 1, PrimaryProduct = "01"
                });
                dataStore.Insert(new CruiseDAL.DataObjects.TallyDO()
                {
                    Tally_CN = 1, Hotkey = "", Description = ""
                });

                dataStore.Insert(new Tree()
                {
                    TreeNumber = 1, Tree_CN = 1, CuttingUnit_CN = 1, Stratum_CN = 1
                });
                dataStore.Insert(new CountTree()
                {
                    CountTree_CN = 1, CuttingUnit_CN = 1, SampleGroup_CN = 1
                });
                dataStore.Insert(new CruiseDAL.DataObjects.TreeEstimateDO()
                {
                    CountTree_CN = 1
                });

                var tallyAction = new TallyAction()
                {
                    TreeCN = 1, CountCN = 1, TreeEstimateCN = 1
                };

                TallyHistoryCollection.Inflate(dataStore, tallyAction);

                tallyAction.TreeRecord.Should().NotBeNull();
                tallyAction.Count.Should().NotBeNull();
                tallyAction.TreeEstimate.Should().NotBeNull();
            }
        }
        public void ReadPlotsTest()
        {
            using (var ds = new CruiseDAL.DAL(readTestFile))
            {
                var wp            = Mock.Of <WindowPresenter>();
                var appController = Mock.Of <ApplicationControllerBase>();
                var target        = new DataEditorView(wp, appController);

                var cu = new CuttingUnitDO()
                {
                    rowID = 1
                };
                var st = new StratumDO()
                {
                    rowID = 1
                };

                var plots = target.ReadPlots(cu, st, false);

                plots.Should().NotBeNullOrEmpty();
            }
        }
Beispiel #4
0
        private CruiseDAL.DAL CreateDatastore(string cruiseMethod, int freqORkz, int insuranceFreq)
        {
            var ds = new CruiseDAL.DAL();

            try
            {
                var sale = new SaleDO()
                {
                    DAL               = ds,
                    SaleNumber        = "12345",
                    Region            = "1",
                    Forest            = "1",
                    District          = "1",
                    Purpose           = "something",
                    LogGradingEnabled = true
                };
                sale.Save();

                var stratum = new StratumDO()
                {
                    DAL    = ds,
                    Code   = "01",
                    Method = cruiseMethod
                };
                stratum.Save();

                var cuttingUnit = new CuttingUnitDO()
                {
                    DAL  = ds,
                    Code = "01"
                };
                cuttingUnit.Save();

                var cust = new CuttingUnitStratumDO()
                {
                    DAL         = ds,
                    CuttingUnit = cuttingUnit,
                    Stratum     = stratum
                };
                cust.Save();

                var sampleGroup = new SampleGroupDO()
                {
                    DAL                = ds,
                    Stratum            = stratum,
                    Code               = "01",
                    PrimaryProduct     = "01",
                    UOM                = "something",
                    CutLeave           = "something",
                    InsuranceFrequency = insuranceFreq
                };

                if (CruiseMethods.THREE_P_METHODS.Contains(cruiseMethod))
                {
                    sampleGroup.KZ = freqORkz;
                }
                else
                {
                    sampleGroup.SamplingFrequency = freqORkz;
                }

                sampleGroup.Save();

                var tally = new TallyDO()
                {
                    DAL         = ds,
                    Hotkey      = "A",
                    Description = "something"
                };
                tally.Save();

                var count = new CountTreeDO()
                {
                    DAL         = ds,
                    CuttingUnit = cuttingUnit,
                    SampleGroup = sampleGroup,
                    Tally       = tally
                };
                count.Save();

                return(ds);
            }
            catch
            {
                ds.Dispose();
                throw;
            }
        }