public async Task Add(Pin entity) { var addedEntry = PinTable.New(entity); await context.Pins.AddAsync(addedEntry); await context.SaveChangesAsync(); }
/// <summary> /// Populates the Circuit, Node and Pin tables /// </summary> /// <param name="circuit"></param> public static void RegisterCircuit(Circuit circuit) { CircuitTable.Add(circuit.CircuitId, circuit); foreach (Node node in circuit.Nodes) { NodeTable.Add(node.NodeId, node); foreach (Pin pin in node.Pins) { PinTable.Add(pin.PinId, pin); } } }
public void TestNodeTraversal() { Circuit testCircuit = createTestCircuit01(); RegisterCircuit(testCircuit); StepThroughCircuit(testCircuit.StartingNodeId); // Make sure every pin has been turned on by the NodeTraversal logic foreach (Node node in testCircuit.Nodes) { Assert.IsTrue(NodeTable.ContainsKey(node.NodeId)); foreach (Pin pin in node.Pins) { Assert.IsTrue(PinTable.ContainsKey(pin.PinId)); Assert.AreEqual(pin.State, StateEnum.ON); } } ClearAllTables(); }