Ejemplo n.º 1
0
        public void Test_SaveDateCase(string[] carrierInfos, string[] dateStrings, int count)
        {
            SaveTimeStatsService <FakeCarrierTimeStat, FakeCarrierTimeStat> service
                = new FakeSaveTimeDateStatsService(repository.Object);

            List <FakeCarrierTimeStat> infos = carrierInfos.Select((t, i) => new FakeCarrierTimeStat
            {
                Carrier = t, StatTime = DateTime.Parse(dateStrings[i])
            }).ToList();
            int resultCount = service.Save(infos);

            Assert.AreEqual(resultCount, count);
            for (int i = 0; i < resultCount; i++)
            {
                FakeCarrierTimeStat stat = repository.Object.Stats.ElementAt(i);
                Assert.AreEqual(stat.StatTime, DateTime.Parse(dateStrings[i]));
                Assert.AreEqual(stat.Carrier, carrierInfos[i]);
            }
        }
Ejemplo n.º 2
0
        public void Test_SaveSimpleCase(string[] carrierInfos, int count)
        {
            SaveTimeStatsService <FakeCarrierTimeStat, FakeCsvInfo> service
                = new FakeSaveTimeStatsService(repository.Object);

            List <FakeCsvInfo> infos = new List <FakeCsvInfo>();

            infos.AddRange(carrierInfos.Select(x => new FakeCsvInfo {
                Carrier = x
            }));
            int resultCount = service.Save(infos);

            Assert.AreEqual(resultCount, count);
            for (int i = 0; i < resultCount; i++)
            {
                FakeCarrierTimeStat stat = repository.Object.Stats.ElementAt(i);
                Assert.AreEqual(stat.StatTime, DateTime.Today);
                Assert.AreEqual(stat.Carrier, carrierInfos[i]);
            }
        }