示例#1
0
 public void RealtimeSubscriptionServiceAddNullSubscription()
 {
     using (var ctx = CreateRealtimeContext())
     {
         var service   = new RealtimeSubscriptionService(ctx);
         var exception = Record.Exception(() => service.Add(null));
         Assert.NotNull(exception);
         Assert.IsType <ArgumentNullException>(exception);
         Assert.Equal("subscription", ((ArgumentNullException)exception).ParamName);
     }
 }
示例#2
0
        public void RealtimeSubscriptionServiceFindById()
        {
            using (var ctx = GetContextWithData())
            {
                var service      = new RealtimeSubscriptionService(ctx);
                var subscription = service.FindById(1);

                Assert.NotNull(subscription);
                Assert.Equal(1, subscription.Id);
                Assert.Equal("HL7", subscription.SourceMessageType);
                Assert.Equal("RAW", subscription.MessageFormat);
                Assert.True(subscription.IsActive);
            }
        }
示例#3
0
        public void RealtimeSubscriptionServiceAddSubscription()
        {
            var expected = new RealtimeSubscription
            {
                Name = "A",
                SourceMessageType = "HL7",
                MessageFormat     = "RAW",
                RoutingKey        = "HL7.{MessageType}.{EventType}"
            };

            using (var ctx = CreateRealtimeContext())
            {
                var service = new RealtimeSubscriptionService(ctx);
                service.Add(expected);

                var actual = service.FindById(expected.Id);

                Assert.NotNull(actual);
                Assert.True(actual.Id > 0);
                Assert.Equal("HL7", actual.SourceMessageType);
                Assert.Equal("RAW", actual.MessageFormat);
                Assert.True(actual.IsActive);
            }
        }