Esempio n. 1
0
    public void ReifiesStatic_IgnoresNonStaticFields()
    {
        var doc = Config.LoadDocFromString(
            @"---
            intKey: 10   # try to bogusly set a non-static field
            "
            , "ConfigReifierFacts_ReifyString_TestFilename");

        // passes if there are no exceptions
        ConfigReifier.ReifyStatic <TestClass>(doc);
    }
Esempio n. 2
0
    public void ReifiesStatic_Struct()
    {
        var doc = Config.LoadDocFromString(
            @"---
            staticIntKey: 3049
            "
            , "ConfigReifierFacts_ReifyString_TestFilename");

        ConfigReifier.ReifyStatic <ChildStruct>(doc);
        Assert.AreEqual(ChildStruct.staticIntKey, 3049);
    }
Esempio n. 3
0
    public void ReifiesStatic_StaticClass()
    {
        var doc = Config.LoadDocFromString(
            @"---
            staticStringList: [herp, derp]
            "
            , "ConfigReifierFacts_ReifyString_TestFilename");

        ConfigReifier.ReifyStatic(typeof(PureStatic), doc);
        Assert.AreEqual(PureStatic.staticStringList[0], "herp");
        Assert.AreEqual(PureStatic.staticStringList[1], "derp");
    }
Esempio n. 4
0
    public void ReifiesStatic_Class()
    {
        var doc = Config.LoadDocFromString(
            @"---
            staticStringKey: arbitrage
            staticIntArrKey: [4, 4, 0, 0]
            intKey: 10   # test non-static fields
            "
            , "ConfigReifierFacts_ReifyString_TestFilename");

        ConfigReifier.ReifyStatic <TestClass>(doc);
        Assert.AreEqual(TestClass.staticStringKey, "arbitrage");
        Assert.AreEqual(TestClass.staticIntArrKey, new int[] { 4, 4, 0, 0 });
    }