static void Main(string[] args) { ConfigureLogging(); var connSettings = ConnectionSettings.Create().SetDefaultUserCredentials(new UserCredentials("admin", "changeit")); var origin = new LinkerConnectionBuilder(new Uri("tcp://localhost:1112"), connSettings, "origin-01"); var destination = new LinkerConnectionBuilder(new Uri("tcp://localhost:2112"), connSettings, "destination-01"); var service = new LinkerService(origin, destination, new FilterService(new List <Filter> { new Filter(FilterType.EventType, "User*", FilterOperation.Include), new Filter(FilterType.Stream, "domain-*", FilterOperation.Include), new Filter(FilterType.EventType, "Basket*", FilterOperation.Exclude) }), Settings.Default(), new NLogLogger()); service.Start().Wait(); Log.Info("Replica Service started"); TestReplicaForSampleEvent(connSettings, destination, "domain-test-01", "UserReplicaTested"); Log.Info("Press enter to exit the program"); Console.ReadLine(); }
public void Replica_start_without_errors() { // Set up var originBuilder = new Mock <Linker.ILinkerConnectionBuilder>(); var connection = new Mock <IEventStoreConnection>(); originBuilder.Setup(a => a.Build()).Returns(connection.Object); var destinationBuilder = new Mock <Linker.ILinkerConnectionBuilder>(); destinationBuilder.Setup(a => a.Build()).Returns(connection.Object); var positionRepo = new Mock <IPositionRepository>(); var sut = new LinkerService(originBuilder.Object, destinationBuilder.Object, positionRepo.Object, null, Settings.Default()); // Act var result = sut.Start().Result; // Verify Assert.IsTrue(result); }