Пример #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            this.Properties["bgStartup"] = false;

            if (e != null && e.Args.Count() > 0)
            {
                if (e.Args[0] == "-bg")
                {
                    this.Properties["bgStartup"] = true;
                }
            }

            Configs             configs             = new Configs();
            PresetFilters       presets             = new PresetFilters();
            OrganisationSyncer  organisationSyncer  = new OrganisationSyncer();
            TrayApp             trayApp             = new TrayApp(organisationSyncer, configs);
            Logger              logger              = new Logger();
            BackgroundOrganiser backgroundOrganiser = new BackgroundOrganiser(new DirectoryModel());
            ForegroundOrganiser foregroundOrganiser = new ForegroundOrganiser(new DirectoryModel());
            BackgroundView      backgroundView      = new BackgroundView();
            ForegroundView      foregroundView      = new ForegroundView();

            DependencyFactory.Container.RegisterInstance <Configs>("configs", configs);
            DependencyFactory.Container.RegisterInstance <PresetFilters>("presets", presets);
            DependencyFactory.Container.RegisterInstance <OrganisationSyncer>("organisationSyncer", organisationSyncer);
            DependencyFactory.Container.RegisterInstance <BackgroundOrganiser>("backgroundOrganiser", backgroundOrganiser);
            DependencyFactory.Container.RegisterInstance <ForegroundOrganiser>("foregroundOrganiser", foregroundOrganiser);
            DependencyFactory.Container.RegisterType <BackgroundView>();
            DependencyFactory.Container.RegisterType <ForegroundView>();
            DependencyFactory.Container.RegisterType <PresetsView>();
            DependencyFactory.Container.RegisterInstance <TrayApp>("trayApp", trayApp);
            DependencyFactory.Container.RegisterInstance <Logger>("logger", logger);
        }
Пример #2
0
        public ForegroundViewModel(TrayApp trayApp, PresetFilters presets, OrganisationSyncer organisationSyncer,
                                   ForegroundOrganiser fgOrganiser, Logger logger)
        {
            _trayApp            = trayApp;
            _presets            = presets;
            _organisationSyncer = organisationSyncer;
            _fgOrganiser        = fgOrganiser;
            _logger             = logger;

            OnInitialise();
        }
Пример #3
0
        public BackgroundViewModel(TrayApp trayApp, PresetFilters presets, Configs configs, OrganisationSyncer organisationSyncer,
                                   BackgroundOrganiser bgOrganiser)
        {
            _trayApp            = trayApp;
            _configs            = configs;
            _presets            = presets;
            _organisationSyncer = organisationSyncer;
            _bgOrganiser        = bgOrganiser;

            OnInitialise();
        }
Пример #4
0
        public void PresetTypeExistsTest()
        {
            PresetFilters target     = new PresetFilters();
            string        presetName = "AreYouMockingMe";
            List <string> types      = new List <string>()
            {
                "Yes"
            };

            target.AddPreset(presetName, types);

            Assert.IsTrue(target.PresetTypeExists(presetName, "Yes"), "Added type does not appear to exist");
        }
Пример #5
0
        public void PresetExistsTest()
        {
            PresetFilters target     = new PresetFilters();
            string        presetName = "MockedYouOut";
            List <string> types      = new List <string>()
            {
                "Mocking"
            };

            target.AddPreset(presetName, types);

            Assert.IsTrue(target.PresetExists(presetName), "Added preset does not appear to exist");
        }
Пример #6
0
        public void RemovePresetTypeTest()
        {
            PresetFilters target     = new PresetFilters();
            string        presetName = "MockingBird";
            List <string> types      = new List <string>()
            {
                "MockING"
            };

            target.AddPreset(presetName, types);
            target.RemovePresetType(presetName, "MockING");

            Assert.IsFalse(target.PresetTypeExists(presetName, "MockING"), "Added type does not appear to exist");
        }
Пример #7
0
        public void GetPresetTypesTest()
        {
            PresetFilters target     = new PresetFilters();
            string        presetName = "MockedOut";
            List <string> types      = new List <string>()
            {
                "Mocking"
            };

            target.AddPreset(presetName, types);

            List <string> returnTypes = target.GetPresetTypes(presetName);

            Assert.IsTrue(returnTypes.Contains("Mocking"), "Added type has not been found");
        }
Пример #8
0
        public void AddPresetTest()
        {
            bool condition = false;

            PresetFilters target     = new PresetFilters();
            string        presetName = null;
            List <string> types      = null;

            try
            {
                target.AddPreset(presetName, types);
            }
            catch (ArgumentException AEx)
            {
                condition = true;
            }

            Assert.IsTrue(condition);

            condition = true;

            presetName = "MockPreset";
            types      = new List <string>()
            {
                "mp3"
            };

            try
            {
                target.AddPreset(presetName, types);
            }
            catch (ArgumentException AEx)
            {
                condition = false;
            }

            Assert.IsTrue(condition);
        }
Пример #9
0
        public void EditPresetsTest()
        {
            PresetFilters target = new PresetFilters();

            string        presetName = "MockedUp";
            List <string> types      = new List <string>()
            {
                "Mocking"
            };

            target.AddPreset(presetName, types);

            List <string> newTypes = new List <string>()
            {
                "Mark"
            };
            string newName = "Marking";

            target.EditPresets(presetName, newName, newTypes);

            Assert.IsTrue(target.PresetExists("Marking"), "Preset name has not been changed");
            Assert.IsTrue(target.PresetTypeExists("Marking", "Mark"), "New types have not been added");
        }
Пример #10
0
        public void AddPresetTypeTest()
        {
            PresetFilters target = new PresetFilters();

            string presetName = "MockPreset";
            string type       = string.Empty; //Empty string should throw exception

            bool shouldThrowException = false;

            try
            {
                target.AddPresetType(presetName, type);
            }
            catch (ArgumentException AEx)
            {
                shouldThrowException = true;
            }

            Assert.IsTrue(shouldThrowException);


            type = "mp4"; // valid filetype, should not throw exception

            bool shouldNotThrowException = true;

            try
            {
                target.AddPresetType(presetName, type);
            }
            catch (ArgumentException AEx)
            {
                shouldNotThrowException = false;
            }

            Assert.IsTrue(shouldNotThrowException);
        }