Beispiel #1
0
        public static void init(

            )
        {
            var        icon          = AbstractResourceTest.GetTestAbstractImage();
            PlanetType t1            = null;
            var        yieldResource =
                SingularGameResourceYieldTest.getTestSingularGameResourceYield(
                    type: GameResourceTest.getTestGameResourceType(),
                    value: 500
                    );
            var fullYield =
                GameResourceYieldTest.GetTestFinishedGameResourceYield(yieldResource);

            Assert.DoesNotThrow(() => t1 = getTestPlanetType(
                                    id: 0,
                                    image: icon,
                                    name: "Test1",
                                    desc: "TestD1",
                                    calc: count => fullYield
                                    ));

            var calcYield = t1.getYield(123);

            Assert.Multiple(() => {
                Assert.AreEqual(0, t1.id);
                Assert.AreEqual("Test1", t1.name);
                Assert.AreEqual("TestD1", t1.description);
                Assert.AreEqual(icon, t1.icon);
                Assert.AreEqual(fullYield, calcYield);
            });
        }
Beispiel #2
0
        public static void init()
        {
            var         icon          = AbstractResourceTest.GetTestAbstractImage();
            ClusterType t1            = null;
            var         yieldResource =
                getTestSingularGameResourceYield(
                    type: GameResourceTest.getTestGameResourceType(),
                    value: 500
                    );
            var fullYield =
                GameResourceYieldTest.GetTestFinishedGameResourceYield(yields: yieldResource);
            YieldModifier yieldMod = (yield) => yield.scalePure(2).readOnly();

            Assert.DoesNotThrow(() => t1 = getTestClusterType(
                                    id: 0,
                                    image: icon,
                                    name: "Test1",
                                    desc: "TestD1",
                                    mod: yieldMod
                                    ));


            Assert.Multiple(() => {
                Assert.AreEqual(0, t1.id);
                Assert.AreEqual("Test1", t1.name);
                Assert.AreEqual("TestD1", t1.description);
                Assert.AreEqual(icon, t1.icon);
                Assert.AreNotSame(fullYield, t1.modifyYield(fullYield));
                Assert.AreNotEqual(fullYield, t1.modifyYield(fullYield));
            });
        }
Beispiel #3
0
        public static PlanetType getTestPlanetType(
            ElementId?id         = null,
            AbstractImage image  = null,
            string name          = "TestPlanetType",
            string desc          = "TestDescription",
            YieldCalculator calc = null
            )
        {
            ElementId _id = id.GetValueOrDefault(0);

            image = image ?? AbstractResourceTest.GetTestAbstractImage();
            calc  = calc ?? NULL_YIELD;
            return(TestConstructor.testBuildObject(
                       () => new PlanetType(
                           id: _id,
                           icon: image,
                           name: name,
                           description: desc,
                           yieldCalculator: calc
                           )
                       ));
        }
Beispiel #4
0
        public static ClusterType getTestClusterType(
            ElementId?id        = null,
            AbstractImage image = null,
            string name         = "TestClusterType",
            string desc         = "TestDescription",
            YieldModifier mod   = null
            )
        {
            ElementId _id = id.GetValueOrDefault(0);

            image = image ?? AbstractResourceTest.GetTestAbstractImage();
            mod   = mod ?? NOOP_MODIFIER;
            return(TestConstructor.testBuildObject(
                       () => new ClusterType(
                           id: _id,
                           icon: image,
                           name: name,
                           description: desc,
                           yieldModifier: mod
                           )
                       ));
        }