コード例 #1
0
        public void LoadArchiveCountParsesDateCorrectly()
        {
            var reader = new TestDataReader();

            reader.AddRecord(1, 2, 2005, 23);
            reader.AddRecord(1, 23, 2005, 23);

            ICollection <ArchiveCount> archive = DataHelper.ReadArchiveCount(reader);

            Assert.AreEqual(2, archive.Count, "Should only have two records.");

            ArchiveCount first  = null;
            ArchiveCount second = null;

            foreach (ArchiveCount count in archive)
            {
                if (first == null)
                {
                    first = count;
                    continue;
                }

                if (second == null)
                {
                    second = count;
                    continue;
                }
            }

            Assert.AreEqual(DateTime.ParseExact("01/02/2005", "MM/dd/yyyy", CultureInfo.InvariantCulture), first.Date,
                            "Something happened to the date parsing.");
            Assert.AreEqual(DateTime.ParseExact("01/23/2005", "MM/dd/yyyy", CultureInfo.InvariantCulture), second.Date,
                            "Something happened to the date parsing.");
        }
コード例 #2
0
        public void LoadArchiveCountParsesDateCorrectly()
        {
            var reader = new TestDataReader();
            reader.AddRecord(1, 2, 2005, 23);
            reader.AddRecord(1, 23, 2005, 23);

            ICollection<ArchiveCount> archive = DataHelper.ReadArchiveCount(reader);
            Assert.AreEqual(2, archive.Count, "Should only have two records.");

            ArchiveCount first = null;
            ArchiveCount second = null;

            foreach(ArchiveCount count in archive)
            {
                if(first == null)
                {
                    first = count;
                    continue;
                }

                if(second == null)
                {
                    second = count;
                    continue;
                }
            }

            Assert.AreEqual(DateTime.ParseExact("01/02/2005", "MM/dd/yyyy", CultureInfo.InvariantCulture), first.Date,
                            "Something happened to the date parsing.");
            Assert.AreEqual(DateTime.ParseExact("01/23/2005", "MM/dd/yyyy", CultureInfo.InvariantCulture), second.Date,
                            "Something happened to the date parsing.");
        }