Ejemplo n.º 1
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.º 2
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));
        }