public async Task EventSubsriptionsShouldThrowErrorForEventThatDoesNotHaveAStore() { //Arrange var e = new EmployeeAddedEvent( new Employee(new Company(1, "", new List <EldProvider>() { new JjKellerEldProvider("sdlkfj") }), 1, "", "", ""), DateTime.Now); var store = new TestEventHanlderStore(); var service = new EventSubscriptions(new List <IntegrationStore>() { store }); //Act try { await service.GetSubscriptions <EmployeeAddedEvent>(e); } catch (Exception exception) { //Assert Assert.AreEqual("IntegrationStore for integration type JjKeller has not implemented.", exception?.InnerException?.Message); throw; } }
public async Task EventSubsriptionsShouldThrowErrorForTwoStoreOfTheSameIntegrationProvider() { //Arrange var e = new EmployeeAddedEvent( new Employee(new Company(1, "", new List <EldProvider>() { new KeepTruckinEldProvider("sdlkfj") }), 1, "", "", ""), DateTime.Now); var store = new TestEventHanlderStore(); var store2 = new TestEventHanlderDuplicateStore(); var service = new EventSubscriptions(new List <IntegrationStore>() { store, store2 }); //Act try { await service.GetSubscriptions <EmployeeAddedEvent>(e); } catch (Exception exception) { //Assert Assert.AreEqual("There are more than one IntegrationStores for integration KeepTruckin", exception?.InnerException?.Message); throw; } }
public async Task EventSubsriptionsShouldReturnListOfValidHandlers() { //Arrange var e = new EmployeeAddedEvent( new Employee(new Company(1, "", new List <EldProvider>() { new KeepTruckinEldProvider("sdlkfj") }), 1, "", "", ""), DateTime.Now); var store = new TestEventHanlderStore(); var service = new EventSubscriptions(new List <IntegrationStore>() { store }); //Act var subscriptions = await service.GetSubscriptions <EmployeeAddedEvent>(e); //Assert Assert.AreEqual(1, subscriptions.Count()); }
public async Task EventSubsriptionsShouldReturnEmptyListWhenEventProviderListDoesNotMatchProvidersReturnedFromSubscription() { //Arrange var e = new EmployeeAddedEvent( new Employee(new Company(1, "", new List <EldProvider>() { new JjKellerEldProvider("sdlkfj") }), 1, "", "", ""), DateTime.Now); var store = new TestEventHanlderStore(); var store2 = new TestJjKellerEventHanlderStore(); var service = new EventSubscriptions(new List <IntegrationStore>() { store, store2 }); //Act var subscriptions = await service.GetSubscriptions <EmployeeAddedEvent>(e); //Assert Assert.AreEqual(0, subscriptions.Count()); }