Beispiel #1
0
    public void WriteXMLTest()
    {
        ScheduledEvent evt = new ScheduledEvent(
            "test",
            (ev) => Debug.ULogChannel("ScheduledEventTest", "Event {0} fired", ev.Name),
            3.0f,
            true,
            1);

        StringBuilder sb     = new StringBuilder();
        XmlWriter     writer = new XmlTextWriter(new StringWriter(sb));

        evt.WriteXml(writer);

        Assert.That(sb.ToString(), Is.EqualTo("<Event name=\"test\" cooldown=\"3\" timeToWait=\"3\" repeatsForever=\"True\" />"));

        evt = new ScheduledEvent(
            "test",
            callback,
            3.0f,
            false,
            2);

        sb     = new StringBuilder();
        writer = new XmlTextWriter(new StringWriter(sb));
        evt.WriteXml(writer);

        Assert.That(sb.ToString(), Is.EqualTo("<Event name=\"test\" cooldown=\"3\" timeToWait=\"3\" repeatsLeft=\"2\" />"));
    }