         
         XCTAssertFalse(modifiedElectricityConsumerConditionable.conditions.has(content: .NotPowered))
     }
+    
+    func testUpdatesConsumersIfInsufficientProduction() {
+        /// adding electricity producer
+        let producedElectricityAmount = 100
+        let electricityProducer = ElectricityProducerPloppTestDouble(origin: (1, 0), producesAmount: producedElectricityAmount)
+        do {
+            try subject!.city.map.plopp(plopp: electricityProducer)
+        } catch {
+            XCTFail("should not fail")
+        }
+        
+        /// adding electricity consumer
+        let consumedElectricityAmount = producedElectricityAmount * 2
+        
+        let electricityConsumerOrigin = (1, electricityProducer.maxX + 1)
+        let electricityConsumer = ElectricityConsumerPloppTestDouble(origin: electricityConsumerOrigin, consumesAmount: consumedElectricityAmount)
+        
+        do {
+            try subject!.city.map.plopp(plopp: electricityConsumer)
+        } catch {
+            XCTFail("should not fail")
+        }
+        
+        subject!.advance()
+        
+        /// Todo
+    }
 
 }

        super.tearDown()
    }
    
    func testUpdatesElectricitySupply() {
        XCTAssertEqual(0, subject!.city.ressources.electricitySupply)


        
        XCTAssertEqual(0, subject!.city.ressources.electricityDemand)
    }
    
    /// MARK: electricity needs recalculation when adding or removing consumers
    
    func testAddConsumerWhenDemandNotGreaterThanSupply() {
        subject!.city.ressources.electricitySupply = 100
        subject!.city.ressources.electricityDemand = 1
        
        /// adding electricity consumer with electricity consumption equal to production
        let electricityConsumerOrigin = (1, 0)
        let electricityConsumer = ElectricityConsumerPloppTestDouble(origin: electricityConsumerOrigin, consumesAmount: 1)
        
        subject!.city.ressources.electricityNeedsRecalculation = false
        do {
            try subject!.city.map.plopp(plopp: electricityConsumer)
        } catch {
            XCTFail("should not fail")
        }
        
        XCTAssertFalse(subject!.city.ressources.electricityNeedsRecalculation)
    }
    
    func testAddConsumerWhenDemandGreaterThanSupply() {
        subject!.city.ressources.electricitySupply = 1
        subject!.city.ressources.electricityDemand = 100
        
        /// adding electricity consumer with electricity consumption greater than production
        
        let electricityConsumerOrigin = (1, 0)
        let electricityConsumer = ElectricityConsumerPloppTestDouble(origin: electricityConsumerOrigin, consumesAmount: 100)
        
        subject!.city.ressources.electricityNeedsRecalculation = false
        do {
            try subject!.city.map.plopp(plopp: electricityConsumer)
        } catch {
            XCTFail("should not fail")
        }
        
        XCTAssert(subject!.city.ressources.electricityNeedsRecalculation)
    }
    
    func testRemoveConsumerWhenDemandNotGreaterThanSupply() {
        subject!.city.ressources.electricitySupply = 100
        subject!.city.ressources.electricityDemand = 1
        
        /// adding electricity consumer with electricity consumption equal to production
        let electricityConsumerOrigin = (1, 0)
        let electricityConsumer = ElectricityConsumerPloppTestDouble(origin: electricityConsumerOrigin, consumesAmount: 1)
        
        do {
            try subject!.city.map.plopp(plopp: electricityConsumer)
            subject!.city.ressources.electricityNeedsRecalculation = false
            try subject!.city.map.removeAt(location: Location(origin: electricityConsumerOrigin))
        } catch {
            XCTFail("should not fail")
        }
        
        XCTAssertFalse(subject!.city.ressources.electricityNeedsRecalculation)
    }
    
    func testRemoveConsumerWhenDemandGreaterThanSupply() {
        subject!.city.ressources.electricitySupply = 1
        subject!.city.ressources.electricityDemand = 100
        
        /// adding electricity consumer with electricity consumption greater than production
        let electricityConsumerOrigin = (1, 0)
        let electricityConsumer = ElectricityConsumerPloppTestDouble(origin: electricityConsumerOrigin, consumesAmount: 1)
        
        do {
            try subject!.city.map.plopp(plopp: electricityConsumer)
            subject!.city.ressources.electricityNeedsRecalculation = false
            try subject!.city.map.removeAt(location: Location(origin: electricityConsumerOrigin))
        } catch {
            XCTFail("should not fail")
        }
        
        XCTAssertTrue(subject!.city.ressources.electricityNeedsRecalculation)
    }
    
    /// MARK: electricity needs recalculation when adding or removing producers
    
    func testAddProducerWhenDemandNotGreaterThanSupply() {
        subject!.city.ressources.electricitySupply = 1
        subject!.city.ressources.electricityDemand = 0
        subject!.city.ressources.electricityNeedsRecalculation = false
        
        /// adding electricity producer
        let electricityProducer = ElectricityProducerPloppTestDouble(origin: (1, 0), producesAmount: 1)
        do {
            try subject!.city.map.plopp(plopp: electricityProducer)
        } catch {
            XCTFail("should not fail")
        }
        
        XCTAssertFalse(subject!.city.ressources.electricityNeedsRecalculation)
    }
    
    func testAddProducerWhenDemandGreaterThanSupply() {
        subject!.city.ressources.electricitySupply = 0
        subject!.city.ressources.electricityDemand = 1
        subject!.city.ressources.electricityNeedsRecalculation = false
        
        /// adding electricity producer
        let electricityProducer = ElectricityProducerPloppTestDouble(origin: (1, 0), producesAmount: 1)
        do {
            try subject!.city.map.plopp(plopp: electricityProducer)
        } catch {
            XCTFail("should not fail")
        }
        
        XCTAssertTrue(subject!.city.ressources.electricityNeedsRecalculation)
    }
    
    func testRemoveProducerWhenDemandNotGreaterThanSupply() {
        subject!.city.ressources.electricitySupply = 1
        subject!.city.ressources.electricityDemand = 0
        
        /// adding electricity producer
        let electricityProducer = ElectricityProducerPloppTestDouble(origin: (1, 0), producesAmount: 1)
        do {
            try subject!.city.map.plopp(plopp: electricityProducer)
            subject!.city.ressources.electricityNeedsRecalculation = false
            try subject!.city.map.removeAt(location: Location(origin: (1, 0)))
        } catch {
            XCTFail("should not fail")
        }
        
        XCTAssertFalse(subject!.city.ressources.electricityNeedsRecalculation)
    }
    
    func testRemoveProducerWhenDemandGreaterThanSupply() {
        subject!.city.ressources.electricitySupply = 0
        subject!.city.ressources.electricityDemand = 1
        
        /// adding electricity producer
        let electricityProducer = ElectricityProducerPloppTestDouble(origin: (1, 0), producesAmount: 1)
        do {
            try subject!.city.map.plopp(plopp: electricityProducer)
            subject!.city.ressources.electricityNeedsRecalculation = false
            try subject!.city.map.removeAt(location: Location(origin: (1, 0)))
        } catch {
            XCTFail("should not fail")
        }
        
        XCTAssertTrue(subject!.city.ressources.electricityNeedsRecalculation)
    }
    
    /// MARK: electricity needs recalculation when adding or removing ressource carrier
    
    func testAddRessourceCarrier() {
        do {
            try subject!.city.map.plopp(plopp: StreetPloppTestDouble(origin: (1, 0), height: 1, width: 10))
        } catch {
            XCTFail("should not fail")
        }
        
        XCTAssertTrue(subject!.city.ressources.electricityNeedsRecalculation)
    }
    
    func testRemoveRessourceCarrier() {
        do {
            try subject!.city.map.removeAt(location: Location(origin: (0, 0)))
        } catch {
            XCTFail("should not fail")
        }
        
        XCTAssertTrue(subject!.city.ressources.electricityNeedsRecalculation)
    }
    
    /// MARK: update consumers scenarios

    func testUpdatesConsumersIfNoProduction() {
        /// adding electricity consumer
