public void Publishes() { var repository = new InMemoryRecordMapper<FakePublicationRecord>(); var blobStorage = new InMemoryBlobStorage(); var serializer = new JsonMessageSerializer(); var transport = new InMemoryMessageChannel(); var registry = new PublicationRegistry<FakePublicationRecord, FakePublicationRecord>( repository, blobStorage, serializer); var publisher = new DefaultPublisher(registry, transport); var start = DateTime.Now; var createdBy = new Guid("C60696AF-F2F8-44EB-B9A1-7967693AC466"); var identifier = new Guid("EF994892-F442-4681-AD1C-217BB11A6D38"); var message = new FakeMessage { Created = start, CreatedBy = createdBy, Identifier = identifier }; var recordId = publisher.PublishMessage(message); Assert.NotNull(recordId); Assert.AreNotEqual(Guid.Empty, recordId); var record = registry.GetPublicationRecord(recordId); Assert.NotNull(record); Assert.AreEqual(typeof(FakeMessage), record.MessageType); var retrieved = registry.GetMessage(record.MessageLocation, record.MessageType); Assert.NotNull(retrieved); Assert.AreEqual(message.Identifier, retrieved.Identifier); Assert.AreEqual(message.Created.ToString(), retrieved.Created.ToString()); Assert.AreEqual(message.Identifier, retrieved.Identifier); }
public void Setup() { var blobStorage = new InMemoryBlobStorage(); blobStorage.Configure(new BlobStorageSettings()); _blobTester = new BlobTester(blobStorage); }
public void SetupTest() { var storage = new InMemoryBlobStorage(); var serializer = new JsonMessageSerializer(); var repository = new InMemoryRecordMapper<FakePublicationRecord>(); _registryTester = new RegistryTester<PublicationRegistry<FakePublicationRecord, FakePublicationRecord>>( new PublicationRegistry<FakePublicationRecord, FakePublicationRecord>(repository, storage, serializer)); }
public void Setup() { if (_session == null) { ConfigureDatabase(); } var storage = new InMemoryBlobStorage(); var serializer = new JsonMessageSerializer(); var repo = new NhRecordMapper<FakePublicationRecord>(_session); _tester = new RecordMapperTester<NhRecordMapper<FakePublicationRecord>>(repo); }
private void ConfigureContainer() { _container = new WindsorContainer(); var recordMapper = new InMemoryRecordMapper<CommandPublicationRecord>(); var blobStorage = new InMemoryBlobStorage(); var messageSerializer = new JsonMessageSerializer(); _container.Register(Component.For<IRecordMapper<CommandPublicationRecord>>().Instance(recordMapper)); _container.Register(Component.For<IBlobStorage>().Instance(blobStorage)); _container.Register(Component.For<IMessageSerializer>().Instance(messageSerializer)); _container.Register(Component.For<IMessageChannel>().Instance(new InMemoryMessageChannel()).Named("input")); _container.Register(Component.For<IMessageChannel>().Instance(new InMemoryMessageChannel()).Named("invalid")); _container.Register(Component.For<FakeCommandProcessor>().ImplementedBy(typeof(FakeCommandProcessor))); _container.Register(Component.For<ICommandRegistry>().Instance(new CommandRegistry(recordMapper, blobStorage, messageSerializer)).Forward<IPublicationRegistry<IPublicationRecord, IPublicationRecord>>()); }