Esempio n. 1
0
        public void Reset()
        {
            // Dispose the in-memory state
            new PartsDisposer().Dispose();

            string file = new PartFileNamer().PartsInfoFilePath;

            // Delete part info (not the actual parts)
            File.Delete(file);

            // Now the parts can be re-scanned and re-initialized
        }
Esempio n. 2
0
        public void Reset()
        {
            // Dispose the in-memory state
            new PartsDisposer().Dispose();

            string file = new PartFileNamer().PartsInfoFilePath;

            // Delete part info (not the actual parts)
            File.Delete(file);

            // Now the parts can be re-scanned and re-initialized
        }
        /// <summary>
        /// Creates mock parts that can be used during testing.
        /// </summary>
        public void CreateMockParts(PartFileNamer namer)
        {
            PartInfo info1 = new PartInfo();
            info1.Action = "Create";
            info1.TypeName = "User";
            info1.PartFilePath = "Parts/User-Create.ascx";

            string part1Path = namer.CreatePartFilePath(info1);

            if (!Directory.Exists(Path.GetDirectoryName(part1Path)))
                Directory.CreateDirectory(Path.GetDirectoryName(part1Path));

            using (StreamWriter writer = File.CreateText(part1Path))
            {
                writer.Write("[mock content]");
                writer.Close();
            }
        }