Exemplo n.º 1
0
        public void TestRouteFind()
        {
            var sim = MoqSim.Create();

            sim.SetUp();
            var roads = sim.GetRoadMap();

            Assert.AreEqual(roads["1-3"].Length, 25);
            Assert.AreEqual(roads["1-3"].Roads[0].Length, 15);
            Assert.AreEqual(roads["1-3"].Roads[14].Length, 15);
            Assert.AreEqual(roads["1-3"].Roads[15].Length, 10);
        }
Exemplo n.º 2
0
        public void TestSealCountDistribution()
        {
            var sim = MoqSim.CreateToCheckSealDistribution();

            sim.SetUp();
            sim.Start(30, new int[] { 25, 25, 30, 20 }, default(CancellationToken));
            var sealInfo   = sim.SealCountStatsGatherer;
            var totalSeals = sealInfo.SealStats.Sum(s => s.Inquiries.Sum());

            Assert.AreEqual(totalSeals,
                            sealInfo.SealDistributions[0] * 1
                            + sealInfo.SealDistributions[1] * 2
                            + sealInfo.SealDistributions[2] * 3
                            + sealInfo.SealDistributions[3] * 4);
        }
Exemplo n.º 3
0
        public void TestSealStats()
        {
            var sim = MoqSim.CreateToCheckSealStats();

            sim.SetUp();
            sim.Start(70, new int[] { 25, 25, 30, 20 }, default(CancellationToken));
            var sealStat1 = sim.SealCountStatsGatherer.SealStats.First(s => s.Node == "1");
            var sealStat2 = sim.SealCountStatsGatherer.SealStats.First(s => s.Node == "2");

            CollectionAssert.AreEqual(
                sealStat1.Stock,
                new List <int>(365).Init(new[] { -100, -400, -600, -900, -1200, -1380, -1580 }).ToArray());
            CollectionAssert.AreEqual(
                sealStat1.Inquiries,
                new List <int>(365).Init(new[] { 100, 300, 200, 300, 300, 200, 200 }).ToArray());
            CollectionAssert.AreEqual(
                sealStat1.Increments,
                new List <int>(365).Init(new[] { 100, 300, 200, 300, 300, 200, 180 }).ToArray());
            CollectionAssert.AreEqual(
                sealStat1.Reuses,
                new List <int>(365).Init(new[] { 0, 0, 0, 0, 0, 20, 0 }).ToArray());
            Assert.AreEqual(sealStat1.Minimum, 1580);

            CollectionAssert.AreEqual(
                sealStat2.Stock,
                new List <int>(365).Init(new[] { 100, 400, 600, 900, 1200, 1380, 1580 }).ToArray());
            CollectionAssert.AreEqual(
                sealStat2.Inquiries,
                new List <int>(365).Init(new[] { 0, 0, 0, 0, 0, 20, 0 }).ToArray());
            CollectionAssert.AreEqual(
                sealStat2.Increments,
                new List <int>(365).Init(new[] { 0, 0, 0, 0, 0, 0, 0 }).ToArray());
            CollectionAssert.AreEqual(
                sealStat2.Reuses,
                new List <int>(365).Init(new[] { 100, 300, 200, 300, 300, 200, 200 }).ToArray());
            Assert.AreEqual(sealStat2.Minimum, 0);
        }