public void GetStateOf_DoesNotContainRequestedGate_ThrowsKeyNotFoundException() { // Arrange var someNonexistingGatenr = 75159; var dut = new GateStates(); // Act var actual = Assert.Throws <KeyNotFoundException>(() => dut.GetStateOf(someNonexistingGatenr)); // Assert actual.Message.Should() .Contain($"{someNonexistingGatenr}"); }
public void Add_Empty_CanBeRetrievedByGatenr() { // Arrange var mockGate = new Mock <IGateState>(); var someGatenr = 4711; var dut = new GateStates(); var expected = mockGate.Object; // Act dut.Add(expected, someGatenr); var actual = dut.GetStateOf(someGatenr); // Assert Assert.Same(expected, actual); }
public void Add_ContainsOtherGates_CanBeRetrievedByGatenr() { // Arrange var mockGate = new Mock <IGateState>(); var someGatenr = 2187; var dut = new GateStates(); // Add other gates - gate numbers are not significant, except that they be unique. dut.Add(NewGate(), 1138); dut.Add(NewGate(), 4711); var expected = mockGate.Object; // Act dut.Add(expected, someGatenr); var actual = dut.GetStateOf(someGatenr); // Assert Assert.Same(expected, actual); }