コード例 #1
0
        public void TestSerialization()
        {
            DefaultConfigurationFileLoader Loader  = new DefaultConfigurationFileLoader();
            FileConfigurationService       Service = new FileConfigurationService(Loader, null, new FileInfo(@"C:\Downloads\ccnet.config.xml"));

            IProject project = Service.Load().Projects["mh_refactor_p"];

            string Serialized = Serialize("project", project);

            System.Diagnostics.Debug.WriteLine(Serialized);
            Project Clone = (Project)Deserialize(Serialized);
        }
コード例 #2
0
		public void Setup()
		{
			configurationFileLoaderMock = new Mock<IConfigurationFileLoader>();
			configurationFileSaverMock = new Mock<IConfigurationFileSaver>();
			configFile = new FileInfo("testFileName");

			fileService = new FileConfigurationService((IConfigurationFileLoader) configurationFileLoaderMock.Object,
			                                           (IConfigurationFileSaver) configurationFileSaverMock.Object,
			                                           configFile);

			configurationMock = new Mock<IConfiguration>();
			configuration = (IConfiguration) configurationMock.Object;
		}
コード例 #3
0
		public void Setup()
		{
			configurationFileLoaderMock = new DynamicMock(typeof (IConfigurationFileLoader));
			configurationFileSaverMock = new DynamicMock(typeof (IConfigurationFileSaver));
			configFile = new FileInfo("testFileName");

			fileService = new FileConfigurationService((IConfigurationFileLoader) configurationFileLoaderMock.MockInstance,
			                                           (IConfigurationFileSaver) configurationFileSaverMock.MockInstance,
			                                           configFile);

			configurationMock = new DynamicMock(typeof (IConfiguration));
			configuration = (IConfiguration) configurationMock.MockInstance;
		}
コード例 #4
0
        /// <summary>
        /// Generates the configuration service.
        /// </summary>
        /// <param name="configFile">The configuration file.</param>
        /// <returns>
        /// The new <see cref="IConfigurationService"/>.
        /// </returns>
        private IConfigurationService NewConfigurationService(string configFile)
        {
            IConfigurationService service = new FileConfigurationService(
                new DefaultConfigurationFileLoader(),
                new DefaultConfigurationFileSaver(new NetReflectorProjectSerializer()),
                new FileInfo(configFile));

            if (this.watchConfigFile)
            {
                service = new FileWatcherConfigurationService(service, new FileChangedWatcher(configFile));
            }

            return(new CachingConfigurationService(service));
        }
コード例 #5
0
ファイル: Menu.cs プロジェクト: d3mage/MyUniRepos
        public Menu()
        {
            regexService  = new RegexService();
            nameGenerator = new FileNameGenerator();

            studentConfigurationService  = new FileConfigurationService <Student>();
            doctorConfigurationService   = new FileConfigurationService <Doctor>();
            mechanicConfigurationService = new FileConfigurationService <Mechanic>();

            name              = "data";
            extension         = "txt";
            studentReadWrite  = studentConfigurationService.ConfigureFileService(name, extension, "student", nameGenerator);
            doctorReadWrite   = doctorConfigurationService.ConfigureFileService(name, extension, "doctor", nameGenerator);
            mechanicReadWrite = mechanicConfigurationService.ConfigureFileService(name, extension, "mechanic", nameGenerator);

            PrintMenu();
        }