Пример #1
0
        public void RiskModSystem_When_Disabled_Check_IsRisky_Returns_True()
        {
            // Create with "Disabled" is true
            var rm = new RiskModSystem(null, true);

            var postAssessEvent = new BIPostNeedsRiskAssessmentEvent(null, null);
            bool risky = rm.IsRisky(postAssessEvent);
            Assert.IsTrue(risky);
        }
Пример #2
0
        public void RiskModSystem_IsRisky_TestRiskyResult()
        {
            var ev = MakeTestBIPostNeedsRiskAssessmentEvent(12);

            var m = new MockRepository();
            var reader = m.DynamicMock<IDnaDataReader>();
            var creator = m.Stub<IDnaDataReaderCreator>();
            creator.Stub(x => x.CreateDnaDataReader("predict_withoutentryid")).Return(reader);
            reader.Stub(x => x.GetIntReturnValue()).Return(1);
            m.ReplayAll();

            var rm = new RiskModSystem(creator, false);

            bool risky = rm.IsRisky(ev);

            Assert.IsTrue(risky);
        }
Пример #3
0
        public void RiskModSystem_IsRisky_TestExceptionHandledAndReturnsTrue()
        {
            var ev = MakeTestBIPostNeedsRiskAssessmentEvent(12);

            var m = new MockRepository();
            var reader = m.DynamicMock<IDnaDataReader>();
            var creator = m.Stub<IDnaDataReaderCreator>();
            creator.Stub(x => x.CreateDnaDataReader("predict_withoutentryid")).Return(reader);
            reader.Stub(x => x.GetIntReturnValue()).Return(0).WhenCalled(x => { throw new Exception("Hello!"); });
            m.ReplayAll();

            var rm = new RiskModSystem(creator, false);

            bool risky = rm.IsRisky(ev);

            Assert.IsTrue(risky);
        }