public void GetValue_GivenTNotOfValue_ThrowsInvalidCastException() { // Arrange var node = new ObservableNode(Guid.NewGuid()); node.SetValue((int)5); // Act Assert.Throws<System.InvalidCastException>( () => { node.GetValue<bool>(); }, // Assert "Value was set with an Integer, yet did not error when trying to extract a boolean."); }
public void GetValue_GivenTOfValue_ReturnsValue() { // Arrange var node = new ObservableNode(Guid.NewGuid()); int expected = 5; node.SetValue(expected); // Act var actual = node.GetValue<int>(); // Assert Assert.AreEqual( expected, actual, "GetValue<int> did not return value, even though the value was set to an int of " + expected); }