Ejemplo n.º 1
0
        public void CountryType_Saved()
        {
            var fakeAmazonDataService = new FakeAmazonDataService();
            var fakeSettingStore      = new FakeSettingStore();

            fakeSettingStore.SavedCountryType = CountryType.Germany;
            fakeSettingStore.countryTypeSaved = true;

            var settingService = new SettingService(fakeAmazonDataService, fakeSettingStore, null);

            Assert.AreEqual(CountryType.Germany, settingService.CountryType);
        }
Ejemplo n.º 2
0
        public void CountryType_Default()
        {
            var fakeAmazonDataService = new FakeAmazonDataService();

            fakeAmazonDataService.CountryType = CountryType.Japan;
            var fakeSettingStore = new FakeSettingStore();
            var settingService   = new SettingService(fakeAmazonDataService, fakeSettingStore, null);

            Assert.AreEqual(CountryType.Japan, settingService.CountryType);
            Assert.IsNull(settingService.AvailableTypes);
            Assert.IsNull(settingService.IndexTypeSettings);
        }
Ejemplo n.º 3
0
        public async Task RefleshAvailableTypes()
        {
            var fakeAmazonDataService = new FakeAmazonDataService();

            fakeAmazonDataService.FakeAvailableTypes = new SearchIndexType[]
            {
                SearchIndexType.Apparel,
                SearchIndexType.Appliances,
            };
            var fakeSettingStore = new FakeSettingStore();
            var fakeSerializer   = new FakeSerializer();
            var settingService   = new SettingService(fakeAmazonDataService, fakeSettingStore, fakeSerializer);
            await settingService.RefleshAvailableTypes();

            Assert.IsNotNull(settingService.AvailableTypes);
            Assert.IsTrue(settingService.AvailableTypes.Any(x => x == SearchIndexType.Apparel));
            Assert.IsTrue(settingService.AvailableTypes.Any(x => x == SearchIndexType.Appliances));
        }
Ejemplo n.º 4
0
        public async Task RestoreIndexTypeSettingFromFileOrFull()
        {
            var fakeAmazonDataService = new FakeAmazonDataService();

            fakeAmazonDataService.FakeAvailableTypes = new SearchIndexType[]
            {
                SearchIndexType.Apparel,
                SearchIndexType.Appliances,
            };
            var fakeSettingStore = new FakeSettingStore();
            var fakeSerializer   = new FakeSerializer();
            var settingService   = new SettingService(fakeAmazonDataService, fakeSettingStore, fakeSerializer);

            await settingService.RefleshAvailableTypes();

            await settingService.RestoreIndexTypeSettingFromFileOrFull();

            Assert.IsNotNull(settingService.IndexTypeSettings);
            Assert.IsTrue(settingService.IndexTypeSettings.Any(x => x.IndexType == SearchIndexType.Apparel));
            Assert.IsTrue(settingService.IndexTypeSettings.Any(x => x.IndexType == SearchIndexType.Appliances));
            Assert.AreEqual(2, settingService.IndexTypeSettings.Count());
            Assert.AreEqual(2, settingService.IndexTypeSettings.Count(x => x.On));
        }