Пример #1
0
        public void TestQueryLastDateStat_SingleTown(string initialDate, int townId, string[] statDates, int[] totalMrs,
                                                     int[] firstNeighbors, int[] secondNeighbors, int[] thirdNeighbors,
                                                     string resultDate, int resultTotal, int resultFirst, int resultSecond, int resultThird)
        {
            _testService.ImportPreciseRecord(townId, statDates, totalMrs, firstNeighbors, secondNeighbors,
                                             thirdNeighbors);
            var result = _testService.QueryLastDateStat(initialDate, "city");

            Assert.IsNotNull(result);
            Assert.AreEqual(result.StatDate, DateTime.Parse(resultDate));
            Assert.AreEqual(result.TownViews.Count(), 1);
            PreciseViewTestService.AssertEqual(result.TownViews.ElementAt(0), new TownPreciseView
            {
                City            = "city",
                District        = "district" + (townId == 1 ? 1 : 2),
                Town            = "town" + townId,
                FirstNeighbors  = resultFirst,
                SecondNeighbors = resultSecond,
                ThirdNeighbors  = resultThird,
                TotalMrs        = resultTotal
            });
            Assert.AreEqual(result.DistrictViews.Count(), 1);
            PreciseViewTestService.AssertEqual(result.DistrictViews.ElementAt(0), new DistrictPreciseView
            {
                City            = "city",
                District        = "district" + (townId == 1 ? 1 : 2),
                FirstNeighbors  = resultFirst,
                SecondNeighbors = resultSecond,
                TotalMrs        = resultTotal
            });
        }
        public void TestQueryLastDateStat_Normal(string initialDate, int townId, string statDate, int totalMrs,
                                                 int firstNeighbors, int secondNeighbors, int thirdNeighbors)
        {
            _testService.ImportPreciseRecord(townId, statDate, totalMrs, firstNeighbors, secondNeighbors, thirdNeighbors);
            var result = _testService.QueryLastDateStat(initialDate, "city");

            Assert.IsNotNull(result);
            Assert.AreEqual(result.StatDate, DateTime.Parse(statDate));
            Assert.AreEqual(result.TownPreciseViews.Count(), 1);
            PreciseViewTestService.AssertEqual(result.TownPreciseViews.ElementAt(0), new TownPreciseView
            {
                City            = "city",
                District        = "district" + (townId == 1 ? 1 : 2),
                Town            = "town" + townId,
                FirstNeighbors  = firstNeighbors,
                SecondNeighbors = secondNeighbors,
                ThirdNeighbors  = thirdNeighbors,
                TotalMrs        = totalMrs
            });
            Assert.AreEqual(result.DistrictPreciseViews.Count(), 1);
            PreciseViewTestService.AssertEqual(result.DistrictPreciseViews.ElementAt(0), new DistrictPreciseView
            {
                City            = "city",
                District        = "district" + (townId == 1 ? 1 : 2),
                FirstNeighbors  = firstNeighbors,
                SecondNeighbors = secondNeighbors,
                TotalMrs        = totalMrs
            });
        }
Пример #3
0
        public void TestQueryLastDateStat_MultiTowns(string initialDate, int[] townIds, string[] statDates, int[] totalMrs,
                                                     int[] firstNeighbors, int[] secondNeighbors, int[] thirdNeighbors,
                                                     string resultDate, int[] resultTownId, int[] resultTotal, int[] resultFirst, int[] resultSecond, int[] resultThird,
                                                     int[] resultDistrictId, int[] districtTotal, int[] districtFirst, int[] districtSecond)
        {
            _testService.ImportPreciseRecord(townIds, statDates, totalMrs, firstNeighbors, secondNeighbors,
                                             thirdNeighbors);
            var result = _testService.QueryLastDateStat(initialDate, "city");

            Assert.IsNotNull(result);
            Assert.AreEqual(result.StatDate, DateTime.Parse(resultDate));
            for (var i = 0; i < resultTownId.Length; i++)
            {
                PreciseViewTestService.AssertEqual(result.TownViews.ElementAt(i), new TownPreciseView
                {
                    City            = "city",
                    District        = "district" + (resultTownId[i] == 1 ? 1 : 2),
                    Town            = "town" + resultTownId[i],
                    FirstNeighbors  = resultFirst[i],
                    SecondNeighbors = resultSecond[i],
                    ThirdNeighbors  = resultThird[i],
                    TotalMrs        = resultTotal[i]
                });
            }
            for (var i = 0; i < resultDistrictId.Length; i++)
            {
                PreciseViewTestService.AssertEqual(result.DistrictViews.ElementAt(i), new DistrictPreciseView
                {
                    City            = "city",
                    District        = "district" + resultDistrictId[i],
                    FirstNeighbors  = districtFirst[i],
                    SecondNeighbors = districtSecond[i],
                    TotalMrs        = districtTotal[i]
                });
            }
        }