コード例 #1
0
ファイル: PlanetType.cs プロジェクト: Kevok93/SpaceGame
        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);
            });
        }
コード例 #2
0
ファイル: ClusterType.cs プロジェクト: Kevok93/SpaceGame
        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));
            });
        }
コード例 #3
0
ファイル: PlanetType.cs プロジェクト: Kevok93/SpaceGame
        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
                           )
                       ));
        }
コード例 #4
0
ファイル: ClusterType.cs プロジェクト: Kevok93/SpaceGame
        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
                           )
                       ));
        }