|
| 1 | +using MEOS.NET.Types; |
| 2 | + |
| 3 | +namespace MEOS.NET.Tests |
| 4 | +{ |
| 5 | + /// <summary> |
| 6 | + /// A value prints as the text MEOS writes it as. MEOS publishes that text per |
| 7 | + /// concrete type, so a class carries <c>ToString</c> exactly where MEOS |
| 8 | + /// publishes an output for its own type. |
| 9 | + /// </summary> |
| 10 | + [TestClass] |
| 11 | + public class TextOutputTests : MeosTest |
| 12 | + { |
| 13 | + [TestMethod] |
| 14 | + public void ATemporalFloatPrintsAsMeosWritesIt() |
| 15 | + { |
| 16 | + Temporal temp = TFloat.In("[25.5@2024-12-06, 27.5@2024-12-07]")!; |
| 17 | + |
| 18 | + Assert.AreEqual( |
| 19 | + "[25.5@2024-12-06 00:00:00+00, 27.5@2024-12-07 00:00:00+00]", |
| 20 | + temp.ToString()); |
| 21 | + } |
| 22 | + |
| 23 | + [TestMethod] |
| 24 | + public void ASpanPrintsAsMeosWritesIt() |
| 25 | + { |
| 26 | + SpanSet spanset = FloatSpanSet.In("{[8, 10], [11, 12]}")!; |
| 27 | + |
| 28 | + Assert.AreEqual("[8, 10]", spanset.StartSpan()!.ToString()); |
| 29 | + Assert.AreEqual("{[8, 10], [11, 12]}", spanset.ToString()); |
| 30 | + } |
| 31 | + |
| 32 | + [TestMethod] |
| 33 | + public void ABoxPrintsAsMeosWritesIt() |
| 34 | + { |
| 35 | + STBox box = STBox.In("STBOX X((1,1),(2,2))")!; |
| 36 | + |
| 37 | + Assert.AreEqual("STBOX X((1,1),(2,2))", box.ToString()); |
| 38 | + } |
| 39 | + |
| 40 | + [TestMethod] |
| 41 | + public void TheTextComesFromTheClassOfTheValue() |
| 42 | + { |
| 43 | + // Wrapping answers the concrete class, so the text is that class's. |
| 44 | + Temporal instant = TFloat.In("25.5@2024-12-06")!; |
| 45 | + |
| 46 | + Assert.IsInstanceOfType(instant, typeof(TFloatInst)); |
| 47 | + Assert.AreEqual("25.5@2024-12-06 00:00:00+00", instant.ToString()); |
| 48 | + } |
| 49 | + } |
| 50 | +} |
0 commit comments