Ejemplo n.º 1
0
        public void Regenerate_RegeneratesEnergy()
        {
            PowerCellCluster cluster = new PowerCellCluster(10);

            Repeat(10, _ => cluster.Add(1000, 1000, 0, 10));
            ProductionBay bay = new ProductionBay(
                null,
                100,
                new List <Recipe <Resource, Resource> > {
                MetalRecipe_WithSkillReq
            },
                (5, 1),
                (100, 0),
                (100, 0),
                0,
                new List <IPowerSource> {
                cluster
            },
                5);

            Repeat(20, i => {
                bay.RegeneratePower( );
                var expected = (i + 1) * 5;
                Assert.IsTrue(bay.Pool.Quantity == expected, $"Expected power in pool to be {expected}, actually {bay.Pool.Quantity}. Failed on index {i}");
            });
            Repeat(20, i => {
                bay.RegeneratePower( );
                var expected = (i + 1) * 5;
                Assert.IsTrue(bay.Reserve.Quantity == expected, $"Expected power in reserve to be {expected}, actually {bay.Pool.Quantity}. Failed on index  {i}");
            });
        }
Ejemplo n.º 2
0
        private List <IPowerSource> PowerGrid(uint size)
        {
            PowerCellCluster cluster = new PowerCellCluster(1);

            cluster.Add(size, size, 0, 0);
            return(new List <IPowerSource> {
                cluster
            });
        }
Ejemplo n.º 3
0
        public void DrawEnergy_DrawsFromSource()
        {
            PowerCellCluster cluster = new PowerCellCluster(10);

            Repeat(10, _ => cluster.Add(1000, 1000, 0, 10));
            ProductionBay bay = new ProductionBay(
                null,
                100,
                new List <Recipe <Resource, Resource> > {
                MetalRecipe_WithSkillReq
            },
                (5, 1),
                (100, 0),
                (100, 0),
                0,
                new List <IPowerSource> {
                cluster
            },
                10);

            bay.DrawEnergy(10);
            Assert.IsTrue(cluster.PowerAvailable == 9990, $"Expected only 10 energy to be drawn, actually {10000 - cluster.PowerAvailable}");
        }