Created
November 13, 2019 11:18
-
-
Save LambdaSix/30d1cdc8f329a15bd67d1628a73c4ffd to your computer and use it in GitHub Desktop.
LTN Export tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Test] | |
| public void Regex_DeliveryCreation() | |
| { | |
| var testLine = | |
| " 599.421 Script @__LogisticTrainNetwork__/control.lua:1405: Creating Delivery: 320 stacks, Chralex >> Frankenfrank\n" + | |
| " 599.421 Script @__LogisticTrainNetwork__/control.lua:1418: item,plastic-bar, 32000 in 320 stacks \n"; | |
| Assert.That(LogRegex.DeliveryCreation.IsMatch(testLine), Is.True); | |
| var deliveryGroups = LogRegex.DeliveryCreation.Match(testLine); | |
| var deliveryCreationTimeStamp = Single.Parse(deliveryGroups.Groups["Timestamp"].Value, NumberStyles.Float); | |
| var deliveryStackCount = deliveryGroups.Groups["StackCount"].Value; | |
| var deliverOrigin = deliveryGroups.Groups["OriginStation"].Value; | |
| var deliveryDestination = deliveryGroups.Groups["DestinationStation"].Value; | |
| var deliveryType = deliveryGroups.Groups["TransportType"].Value; | |
| var deliveryName = deliveryGroups.Groups["TransportedName"].Value; | |
| var transportedCount = Int32.Parse(deliveryGroups.Groups["ItemRawCount"].Value); | |
| var itemStackCount = Int32.Parse(deliveryGroups.Groups["ItemStackCount"].Value); | |
| var deliveryInfo = new DeliveryCreationInfo() | |
| { | |
| Timestamp = deliveryCreationTimeStamp, | |
| DestinationStation = deliveryDestination, | |
| OriginStation = deliverOrigin, | |
| StackCount = itemStackCount, | |
| TransportedCount = transportedCount, | |
| TransportType = deliveryType, | |
| TransportedName = deliveryName, | |
| }; | |
| Assert.AreEqual(599.421M, deliveryInfo.Timestamp); | |
| Assert.AreEqual("Frankenfrank", deliveryInfo.DestinationStation); | |
| Assert.AreEqual("Chralex", deliveryInfo.OriginStation); | |
| Assert.AreEqual(320, deliveryInfo.StackCount); | |
| Assert.AreEqual("item", deliveryInfo.TransportType); | |
| Assert.AreEqual("plastic-bar", deliveryInfo.TransportedName); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment