public void TestReadCsv() { var catalogReposityMock = new Mock<ICatalogRepository>(); var eventBrokerMock = new Mock<IEventBroker>(); var catalog = new SupplierCatalog(); catalog.Id = 1; catalogReposityMock.Setup(x => x.FindById(1)) .Returns(catalog); var catalogService = new CatalogService(eventBrokerMock.Object, catalogReposityMock.Object); var filePath = @"Resources\Hardware.csv"; catalogService.ProcessAction(new ImportHardwareCommand(1, filePath)); catalogReposityMock.Verify(x => x.Save(catalog)); Assert.AreEqual(2, catalog.Hardwares.Count); Assert.AreEqual(2, catalog.Hardwares[0].Components.Count); Assert.AreEqual(4, catalog.Supplies.Count); eventBrokerMock.Verify(x => x.Publish(It.IsAny<HardwareCreatedEvent>()), Times.Exactly(2)); eventBrokerMock.Verify(x => x.Publish(It.IsAny<SupplyCreatedEvent>()), Times.Exactly(4)); }