public void SimpleFlowArrives()
		{
var supply = new WaterSupply();
var pump = new Pump();
var drain = new Drain();
var combinator = new DialyzingFluidFlowCombinator();
pump.PumpSpeed = 7;
combinator.ConnectOutWithIn(supply.MainFlow,pump.MainFlow);
combinator.ConnectOutWithIn(pump.MainFlow, drain.MainFlow);
combinator.CommitFlow();

			var model = new DialyzingFluidFlowModel
			{
				FlowElements = new IComponent[] { supply, pump, drain, combinator }
			};
			
			var simulator = new Simulator(model); //Important: Call after all objects have been created
			simulator.SimulateStep();

			var modelAfterStep = (DialyzingFluidFlowModel) simulator.Model;
			var supplyAfterStep = (WaterSupply)modelAfterStep.Components[0];
			var pumpAfterStep = (Pump)modelAfterStep.Components[1];
			var drainAfterStep = (Drain)modelAfterStep.Components[2];
			pumpAfterStep.MainFlow.Incoming.Backward.CustomSuctionValue.Should().Be(7);
			supplyAfterStep.MainFlow.Outgoing.Forward.Quantity.Should().Be(7);
			drainAfterStep.MainFlow.Incoming.Forward.Quantity.Should().Be(7);
		}
Example #2
0
        public void SimpleFlowArrives()
        {
            var supply     = new WaterSupply();
            var pump       = new Pump();
            var drain      = new Drain();
            var combinator = new DialyzingFluidFlowCombinator();

            pump.PumpSpeed = 7;
            combinator.ConnectOutWithIn(supply.MainFlow, pump.MainFlow);
            combinator.ConnectOutWithIn(pump.MainFlow, drain.MainFlow);
            combinator.CommitFlow();

            var model = new DialyzingFluidFlowModel
            {
                FlowElements = new IComponent[] { supply, pump, drain, combinator }
            };

            var simulator = new SafetySharpSimulator(model);             //Important: Call after all objects have been created

            simulator.SimulateStep();

            var modelAfterStep  = (DialyzingFluidFlowModel)simulator.Model;
            var supplyAfterStep = (WaterSupply)modelAfterStep.Components[0];
            var pumpAfterStep   = (Pump)modelAfterStep.Components[1];
            var drainAfterStep  = (Drain)modelAfterStep.Components[2];

            pumpAfterStep.MainFlow.Incoming.Backward.CustomSuctionValue.Should().Be(7);
            supplyAfterStep.MainFlow.Outgoing.Forward.Quantity.Should().Be(7);
            drainAfterStep.MainFlow.Incoming.Forward.Quantity.Should().Be(7);
        }