Пример #1
0
            public void WhenPeek_ThenReturnsPeekedEvents()
            {
                var events = new List <WebhookEvent>();

                queueStorage.Setup(qs => qs.Peek())
                .Returns(events);

                var results = sink.Peek();

                Assert.That(results, Is.EqualTo(events));
                queueStorage.Verify(qs => qs.Peek());
            }
            public void WhenCreate_ThenQueuesEvent()
            {
                var id    = DataFormats.CreateEntityIdentifier();
                var datum = SystemTime.UtcNow.ToNearestMillisecond();
                var data  = new TestData();

                sink.Write(new WebhookEvent
                {
                    CreatedDateUtc = datum,
                    EventName      = "aneventname",
                    Data           = data,
                    Id             = id
                });

                var result = sink.Peek();

                Assert.That(result.Count, Is.EqualTo(1));
                Assert.That(result[0].CreatedDateUtc, Is.EqualTo(datum));
                Assert.That(result[0].EventName, Is.EqualTo("aneventname"));
                Assert.That(result[0].Data, Is.EqualTo(new TestData().ToJson()));
                Assert.That(result[0].Id, Is.EqualTo(id));
            }