public void WhenGettingEmptyQueryEnumerable_ThenEmptyList()
		{
			var store = new MemoryMessageStore<Message>(() => this.utcNow());
			var enumerable = store.Query().Execute() as IEnumerable;

			Assert.False(enumerable.GetEnumerator().MoveNext());
		}
        public void WhenGettingEmptyQueryEnumerable_ThenEmptyList()
        {
            var store      = new MemoryMessageStore <Message>(() => this.utcNow());
            var enumerable = store.Query().Execute() as IEnumerable;

            Assert.False(enumerable.GetEnumerator().MoveNext());
        }
        public MemoryMessageStoreSpec()
        {
            this.store = new MemoryMessageStore <Message>(() => this.utcNow());

            this.store.Save(new CreateProduct {
                Id = 5, Title = "DevStore"
            }, emptyHeaders);
            this.store.Save(new PublishProduct {
                Version = 1
            }, emptyHeaders);
            this.store.Save(new PublishProduct {
                Version = 2
            }, emptyHeaders);
            this.store.Save(new PublishProduct {
                Version = 3
            }, emptyHeaders);

            this.store.Save(new CreateProduct {
                Id = 6, Title = "WoVS"
            }, emptyHeaders);
            this.store.Save(new PublishProduct {
                Version = 1
            }, emptyHeaders);
            this.store.Save(new PublishProduct {
                Version = 2
            }, emptyHeaders);
        }
		public void WhenNoDateTimeFuncProvided_ThenUsesUtcNow()
		{
			this.store = new MemoryMessageStore<Message>();

			this.store.Save(new CreateProduct { Id = 5, Title = "DevStore" }, emptyHeaders);

			Thread.Sleep(1);

			Assert.True(DateTime.UtcNow.Ticks > this.store.AllMessages.First().Timestamp.Ticks);
		}
        public void MessageStoreTestMethod()
        {
            IMessageStore ms = new MemoryMessageStore();

            Assert.IsTrue(ms != null);

            ms.SaveMessage(new Message1() { Data = "Hello world" }, DateTime.UtcNow.AddMinutes(30).Ticks);
            ms.SaveMessage(new Message2() { Data = "Hello world" }, DateTime.UtcNow.AddMinutes(30).Ticks);

            var msgs = ms.GetMessages(DateTime.UtcNow.Ticks);
            Assert.IsTrue(msgs.Count() == 2);
        }
        public void WhenNoDateTimeFuncProvided_ThenUsesUtcNow()
        {
            this.store = new MemoryMessageStore <Message>();

            this.store.Save(new CreateProduct {
                Id = 5, Title = "DevStore"
            }, emptyHeaders);

            Thread.Sleep(1);

            Assert.True(DateTime.UtcNow.Ticks > this.store.AllMessages.First().Timestamp.Ticks);
        }
		public MemoryMessageStoreSpec()
		{
			this.store = new MemoryMessageStore<Message>(() => this.utcNow());

			this.store.Save(new CreateProduct { Id = 5, Title = "DevStore" }, emptyHeaders);
			this.store.Save(new PublishProduct { Version = 1 }, emptyHeaders);
			this.store.Save(new PublishProduct { Version = 2 }, emptyHeaders);
			this.store.Save(new PublishProduct { Version = 3 }, emptyHeaders);

			this.store.Save(new CreateProduct { Id = 6, Title = "WoVS" }, emptyHeaders);
			this.store.Save(new PublishProduct { Version = 1 }, emptyHeaders);
			this.store.Save(new PublishProduct { Version = 2 }, emptyHeaders);
		}
        public void MessageStoreTimeTestMethod()
        {
            IMessageStore ms = new MemoryMessageStore();

            Assert.IsTrue(ms != null);

            ms.SaveMessage(new Message1() { Data = "Hello world" }, DateTime.UtcNow.AddSeconds(10).Ticks);
            ms.SaveMessage(new Message2() { Data = "Hello world" }, DateTime.UtcNow.AddSeconds(5).Ticks);
            ms.SaveMessage(new Message1() { Data = "Hello world" }, DateTime.UtcNow.AddSeconds(6).Ticks);
            System.Threading.Thread.Sleep(TimeSpan.FromSeconds(8));

            var msgs = ms.GetMessages(DateTime.UtcNow.Ticks);
            Assert.IsTrue(msgs.Count() == 1);
        }
Beispiel #9
0
        public void MessageStoreTestMethod()
        {
            IMessageStore ms = new MemoryMessageStore();

            Assert.IsTrue(ms != null);

            ms.SaveMessage(new Message1()
            {
                Data = "Hello world"
            }, DateTime.UtcNow.AddMinutes(30).Ticks);
            ms.SaveMessage(new Message2()
            {
                Data = "Hello world"
            }, DateTime.UtcNow.AddMinutes(30).Ticks);

            var msgs = ms.GetMessages(DateTime.UtcNow.Ticks);

            Assert.IsTrue(msgs.Count() == 2);
        }
Beispiel #10
0
        public void MessageStoreTimeTestMethod()
        {
            IMessageStore ms = new MemoryMessageStore();

            Assert.IsTrue(ms != null);

            ms.SaveMessage(new Message1()
            {
                Data = "Hello world"
            }, DateTime.UtcNow.AddSeconds(10).Ticks);
            ms.SaveMessage(new Message2()
            {
                Data = "Hello world"
            }, DateTime.UtcNow.AddSeconds(5).Ticks);
            ms.SaveMessage(new Message1()
            {
                Data = "Hello world"
            }, DateTime.UtcNow.AddSeconds(6).Ticks);
            System.Threading.Thread.Sleep(TimeSpan.FromSeconds(8));

            var msgs = ms.GetMessages(DateTime.UtcNow.Ticks);

            Assert.IsTrue(msgs.Count() == 1);
        }