Beispiel #1
0
        public void Build_ShouldReturnCircuit()
        {
            // Act
            Circuit circuit = _circuitBuilder.Build(_nodeDefinitions);

            // Assert
            Assert.IsNotNull(circuit);
        }
        private void OpenCircuit()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            string         filter         = GetFileFilter();

            openFileDialog.Filter = filter;
            if (openFileDialog.ShowDialog() == true)
            {
                string        ext          = Path.GetExtension(openFileDialog.FileName);
                IFileStrategy fileStrategy = _fileStrategyFactory.GetStrategy(ext.Substring(1));
                if (fileStrategy != null)
                {
                    Logger.Log(String.Format("Reading file: '{0}'", openFileDialog.FileName));
                    List <NodeDefinition> nodeDefinitions = fileStrategy.ReadFile(openFileDialog.OpenFile());

                    Logger.Log("Validating file");
                    if (_validator.Validate(nodeDefinitions))
                    {
                        Circuit = _circuitBuilder.Build(nodeDefinitions);
                    }
                }
                else
                {
                    Logger.LogError("Cannot parse files with extension: '" + ext + "'");
                }
            }
        }
        public async Task TestMethod6()
        {
            var builder = new CircuitBuilder()
                          .AddInMemorySource(@"# Hallo There
									In1: INPUT_HIGH;
									In2: INPUT_LOW;
									Out1: PROBE;"                                    )
                          .AddDefaultNodes();

            var c = await builder.Build();
        }
Beispiel #4
0
        public bool BuildCircuit(string filepath)
        {
            CircuitBuilder cb = new CircuitBuilder();

            if (!cb.Create(filepath))
            {
                _mv.ErrorMessage = cb.ErrorMessage;
                return(false);
            }
            _mv.ErrorMessage = cb.ErrorMessage;
            _circuit         = cb.Build();
            _circuit.Inputs.ForEach(inp => inp.InfiniteLoop(null));
            return(true);
        }