Beispiel #1
0
        public void Should_have_identical_timestamps_on_the_events()
        {
            RoutingSlipCompleted         completed         = _completed.Task.Result;
            RoutingSlipActivityCompleted activityCompleted = _activityCompleted.Task.Result;

            Assert.AreEqual(completed.Timestamp, activityCompleted.Timestamp);
        }
        public async Task Should_receive_the_routing_slip_completed_event()
        {
            RoutingSlipCompleted completed = (await _completed).Message;

            Assert.AreEqual(_routingSlip.TrackingNumber, completed.TrackingNumber);

            Console.WriteLine("Duration: {0}", completed.Duration);
        }
        public async Task Should_receive_the_routing_slip_completed_event()
        {
            RoutingSlipCompleted completed = (await _completed).Message;

            Assert.AreEqual(_routingSlip.TrackingNumber, completed.TrackingNumber);

            Console.WriteLine("Duration: {0}", completed.Duration);

            Assert.IsFalse(completed.Variables.ContainsKey("ToBeRemoved"));
        }
Beispiel #4
0
        public static T GetVariable <T>(this RoutingSlipCompleted source, string key)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (string.IsNullOrEmpty(key))
            {
                throw new ArgumentException("The key must not be empty", nameof(key));
            }

            return(DeserializeVariable <T>(key, source.Variables));
        }
Beispiel #5
0
        public async Task Should_complete_with_metrics_available()
        {
            RoutingSlipCompleted completed = (await _completed).Message;

            await _activityMonitor.AwaitBusInactivity(TestCancellationToken);

            using var stream = new MemoryStream();
            await Metrics.DefaultRegistry.CollectAndExportAsTextAsync(stream);

            var text = Encoding.UTF8.GetString(stream.ToArray());

            Console.WriteLine(text);

            Assert.That(text.Contains("mt_activity_execute_total{service_name=\"unit_test\",activity_name=\"SecondTest\",argument_type=\"Test\"} 1"));
            Assert.That(text.Contains("mt_activity_execute_total{service_name=\"unit_test\",activity_name=\"Test\",argument_type=\"Test\"} 1"));
        }
        public static string GetVariable(this RoutingSlipCompleted source, string key)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (string.IsNullOrEmpty(key))
            {
                throw new ArgumentException("The key must not be empty", "key");
            }

            object obj;

            if (!source.Variables.TryGetValue(key, out obj))
            {
                throw new KeyNotFoundException("The variable was not present: " + key);
            }

            return(obj as string);
        }
        public async Task Should_include_the_variables_of_the_completed_routing_slip()
        {
            RoutingSlipCompleted completed = (await _completed).Message;

            Assert.AreEqual("Knife", completed.Variables["Variable"]);
        }
        public async Task Should_include_the_variable_set_by_the_activity()
        {
            RoutingSlipCompleted completed = (await _completed).Message;

            Assert.AreEqual("Hello, World!", completed.GetVariable <string>("Value"));
        }
Beispiel #9
0
        public void Should_include_the_variable_set_by_the_activity()
        {
            RoutingSlipCompleted completed = _completed.Task.Result;

            Assert.AreEqual("Hello, World!", completed.Variables["Value"]);
        }
Beispiel #10
0
        public void Should_include_the_variables_of_the_completed_routing_slip()
        {
            RoutingSlipCompleted completed = _completed.Task.Result;

            Assert.AreEqual("Knife", completed.Variables["Variable"]);
        }
Beispiel #11
0
        public void Should_receive_the_routing_slip_completed_event()
        {
            RoutingSlipCompleted completed = _completed.Task.Result;

            Assert.AreEqual(_routingSlip.TrackingNumber, completed.TrackingNumber);
        }
Beispiel #12
0
        public async Task Should_receive_the_routing_slip_completed_event()
        {
            RoutingSlipCompleted completed = (await _completed).Message;

            Assert.AreEqual(_routingSlip.TrackingNumber, completed.TrackingNumber);
        }
Beispiel #13
0
 static Guid GetTrackingNumber(RoutingSlipCompleted message)
 {
     return(message.TrackingNumber);
 }
 public RoutingSlipCompletedDocument(RoutingSlipCompleted message)
     : base(message.Timestamp, message.Duration)
 {
     Variables = message.Variables;
 }
Beispiel #15
0
 public RoutingSlipCompletedDocument(RoutingSlipCompleted message)
     : base(message.Timestamp, message.Duration)
 {
     Variables = message.Variables;
 }