Beispiel #1
0
    public void ConfigReifier_SetFieldsOnObject_CastedObject()
    {
        var tc  = (object)new TestClass();
        var doc = Config.LoadDocFromString(
            @"---
            intKey: 99077
            "
            , "ConfigReifierFacts_ReifyString_TestFilename");

        ConfigReifier.SetFieldsOnObject(ref tc, doc);
        Assert.AreEqual(((TestClass)tc).intKey, 99077);
    }
Beispiel #2
0
    public void ConfigReifier_SetFieldsOnObject_PlainObject()
    {
        var tc  = new TestClass();
        var doc = Config.LoadDocFromString(
            @"---
            intKey: 99088
            "
            , "ConfigReifierFacts_ReifyString_TestFilename");

        ConfigReifier.SetFieldsOnObject(ref tc, doc);
        Assert.AreEqual(tc.intKey, 99088);
    }
Beispiel #3
0
    public void ConfigReifier_SetFieldsOnObject_BoxedStructArgument()
    {
        var s = new ChildStruct();

        s.childIntKey   = 1;
        s.childFloatKey = 1;
        var doc = Config.LoadDocFromString(
            @"---
            childIntKey: 34567
            "
            , "ConfigReifierFacts_ReifyString_TestFilename");
        object os = (object)s;

        ConfigReifier.SetFieldsOnObject(ref os, doc);
        Assert.AreEqual(((ChildStruct)os).childIntKey, 34567);
        Assert.AreEqual(((ChildStruct)os).childFloatKey, 1);
    }