public void Should_return_production_area() { using (var store = NewDocumentStore()) { new ProductionAreaTransformer().Execute(store); using (var session = store.OpenSession()) { // Arrange var productionArea = new ProductionArea { Name = "Production Area 1" }; session.Store(productionArea); var productionAreaId = productionArea.Id; session.SaveChanges(); var service = new ProducerService(session); // Act var dto = service.GetProductionAreaWithTransformer(productionAreaId); // Assert Assert.NotNull(dto); } } }
public void Should_throw_invalid_operation_exception_when_production_area_does_not_exist_and_using_transformer() { using (var store = NewDocumentStore()) { new ProductionAreaTransformer().Execute(store); using (var session = store.OpenSession()) { // Arrange var productionArea = new ProductionArea { Name = "Production Area 1" }; session.Store(productionArea); var productionAreaId = productionArea.Id; session.SaveChanges(); var service = new ProducerService(session); // Act const string badProductionAreaId = "ProductionAreas-999"; // Assert Assert.Throws <InvalidOperationException>(() => service.GetProductionAreaWithTransformer(badProductionAreaId)); } } }