Exemplo n.º 1
0
        public void ValidateDependencyRegistration()
        {
            var serviceCollection = new ServiceCollection();
            var tester            = new PublisherIntegrationTester <MyGuidModel, Message>();

            tester.RegisterDependencies(serviceCollection);
            Assert.AreEqual(8, serviceCollection.Count);
        }
Exemplo n.º 2
0
        public async Task ValidatePublisherIntegrationGuidIdTester()
        {
            var tester = new PublisherIntegrationTester <MyGuidModel, Message>();
            await tester.GuidCreatePublisher.Object.PublishAsync(new MyGuidModel { Id = Guid.NewGuid() });

            await tester.GuidCreatedPublisher.Object.PublishAsync(new MyGuidModel { Id = Guid.NewGuid() });

            await tester.GuidUpdatedPublisher.Object.PublishAsync(new MyGuidModel { Id = Guid.NewGuid() });

            await tester.GuidDeletedPublisher.Object.PublishAsync(new MyGuidModel { Id = Guid.NewGuid() });

            Assert.AreEqual(4,
                            tester.CreateList.Count +
                            tester.CreatedList.Count +
                            tester.UpdatedList.Count +
                            tester.DeletedList.Count);
        }
Exemplo n.º 3
0
        public async Task ValidatePublisherIntegrationTypedIdTester()
        {
            var tester = new PublisherIntegrationTester <MyIntModel, Message, int>();
            await tester.CreatePublisher.Object.PublishAsync(new MyIntModel { Id = 1 });

            await tester.CreatedPublisher.Object.PublishAsync(new MyIntModel { Id = 2 });

            await tester.UpdatedPublisher.Object.PublishAsync(new MyIntModel { Id = 3 });

            await tester.DeletedPublisher.Object.PublishAsync(new MyIntModel { Id = 4 });

            Assert.AreEqual(10,
                            tester.CreateList.Sum(t => t.Id) +
                            tester.CreatedList.Sum(t => t.Id) +
                            tester.UpdatedList.Sum(t => t.Id) +
                            tester.DeletedList.Sum(t => t.Id));
            Assert.AreEqual(4,
                            tester.CreateList.Count +
                            tester.CreatedList.Count +
                            tester.UpdatedList.Count +
                            tester.DeletedList.Count);
        }