コード例 #1
0
        public void TallyThreePTest_UserDontEnterKPI()
        {
            int?expectedKPI = null;
            int minKPI      = 101;
            int maxKPI      = 102;

            var dialogServiceMock = new Mock <IDialogService>();

            dialogServiceMock.Setup(ds => ds.AskKPI(It.Is <int>(x => x == minKPI), It.Is <int>(x => x == maxKPI), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()))
            .Returns(expectedKPI);

            var sg = new SampleGroup()
            {
                MinKPI = minKPI, MaxKPI = maxKPI
            };

            var count = new CountTree()
            {
                TreeCount = 0, SumKPI = 0
            };
            var sampleSelector = new FMSC.Sampling.ThreePSelecter(1, 0);

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

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

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

            result.Should().BeNull();
        }
コード例 #2
0
        public void TallyThreePTest_STM()
        {
            int expectedKPI = -1;//when kpi is -1, kpi entered was STM
            int minKPI      = 101;
            int maxKPI      = 102;

            var dialogServiceMock = new Mock <IDialogService>();

            dialogServiceMock.Setup(ds => ds.AskKPI(It.Is <int>(x => x == minKPI), It.Is <int>(x => x == maxKPI), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()))
            .Returns(expectedKPI);

            var sg = new SampleGroup()
            {
                MinKPI = minKPI, MaxKPI = maxKPI
            };

            var count = new CountTree()
            {
                TreeCount = 0, SumKPI = 0
            };
            var sampleSelector = new FMSC.Sampling.ThreePSelecter(1, 0);

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

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

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

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

            expectedTree.CountOrMeasure.Should().BeNull();
            expectedTree.STM = "Y";
        }
コード例 #3
0
 private SampleSelecter MakeThreePSampleSelector()
 {
     SampleSelecter selecter = null;
     int iFrequency = (int)this.InsuranceFrequency;
     int KZ = (int)this.KZ;
     int maxKPI = 100000;
     selecter = new FMSC.Sampling.ThreePSelecter(KZ, maxKPI, iFrequency);
     return selecter;
 }