コード例 #1
0
        public void TallyStandardTest()
        {
            var count = new CountTree()
            {
                TreeCount = 0
            };

            FMSC.Sampling.IFrequencyBasedSelecter sampleSelector = new FMSC.Sampling.SystematicSelecter(1, 0, true);//100%

            var expectedTree = new Tree();

            var dataServiceMock = new Moq.Mock <ITreeDataService>();

            dataServiceMock.Setup(ds => ds.CreateNewTreeEntry(It.IsAny <CountTree>())).Returns(expectedTree);

            var dialogServiceMock = new Mock <IDialogService>();
            //dialogServiceMock.Setup()

            var result = FormDataEntryLogic.TallyStandard(count, sampleSelector, dataServiceMock.Object, dialogServiceMock.Object);

            result.Should().NotBeNull();
            result.TreeRecord.Should().BeSameAs(expectedTree);
            result.Count.Should().BeSameAs(count);
            result.TreeCount.Should().Be(1);
            result.KPI.Should().Be(0);

            expectedTree.CountOrMeasure.Should().Be("M");

            sampleSelector = new ZeroPCTSelector();//0%

            sampleSelector.Sample().Should().Be(SampleResult.C);

            result = FormDataEntryLogic.TallyStandard(count, sampleSelector, dataServiceMock.Object, dialogServiceMock.Object);
            result.TreeRecord.Should().BeNull();
            result.TreeCount.Should().Be(1);
            result.KPI.Should().Be(0);
        }