public void TestLong() { var lvp = new LongValue(); Assert.IsTrue(lvp.ValueObject == null); lvp.Parse("10"); Assert.IsTrue(lvp.ValueObject.Equals(10L)); Assert.IsTrue(lvp.GetLong() == 10L); lvp._Long = 200; Assert.IsTrue(lvp.GetLong() == 200L); Assert.IsTrue(lvp.ValueObject.Equals(200L)); try { lvp._Boolean = false; Assert.IsTrue(false); } catch (Exception) { // Expected exception } try { lvp._Int = 20; Assert.IsTrue(false); } catch (Exception) { // Expected exception } try { lvp._String = "test"; Assert.IsTrue(false); } catch (Exception) { // Expected exception } try { lvp = new LongValue(); lvp.GetLong(); } catch (Exception) { // Expected exception } }
private void TryValid(String strLong, long expected) { long result = LongValue.ParseString(strLong); Assert.IsTrue(result == expected); }