Exemplo n.º 1
0
        public void MonitorResultService_AddMonitorResult_Adds()
        {
            var mRepo = new Mock <IMonitorResultRepository>();
            var ep    = new Mock <IEventPublisher>();
            var srv   = new MonitorResultService(mRepo.Object, ep.Object);

            var expected = new MonitorResult
            {
                Actual             = 3.ToString(),
                Expected           = 2.ToString(),
                ComparisonTypeCode = ComparisonType.Equality.Code,
            };

            srv.AddMonitorResult(expected);
            mRepo.Verify(m => m.Add(It.Is <MonitorResult>(actual => ExpectedMonitorResultValues(actual, expected))), Times.Once);
            ep.Verify(
                e => e.Publish(It.Is <CreatedEvent <MonitorResult> >(ce => ExpectedMonitorResultValues(ce.DomainModel, expected))),
                Times.Once);
        }
Exemplo n.º 2
0
        public void MonitorResultService_AddMonitorResult_Throws()
        {
            var srv = new MonitorResultService(null, null);

            Should.Throw <NullReferenceException>(() => srv.AddMonitorResult(null));
        }