Exemplo n.º 1
0
        public void FileIsCorrectlyCreatedIfNotPresent()
        {
            var d = new Dummy(testFile, "asdfasdf");

            Assert.IsTrue(File.Exists(testFile));
            using (var strm = new StreamReader(testFile))
                Assert.AreEqual("asdfasdf", strm.ReadToEnd());
            Assert.AreEqual(File.GetLastWriteTimeUtc(testFile), Dummy.BaseTime());
        }
Exemplo n.º 2
0
        public void ExistingFileDataIsCorrectlyMerged()
        {
            var old = "some __template:data__ with __var__";
            var New = "a __template:stuff__ with __var__ __more__";

            using (var file = File.Create(testFile))
                using (var strm = new StreamWriter(file))
                    strm.Write(old);
            File.SetLastWriteTimeUtc(testFile, Dummy.BaseTime().AddMinutes(-5));
            new Dummy(testFile, New);
            string f;

            using (var strm = new StreamReader(testFile))
                f = strm.ReadToEnd();
            Assert.AreEqual(New.Replace("stuff", "data"), f);
        }