public async Task SaveGenericComponents_ShouldSaveComponents()
        {
            var result = await _genericComponentRepository.SaveGenericComponents(_genericComponents);

            Assert.NotNull(result);
            Assert.Equal(_genericComponents, result);
        }
Beispiel #2
0
        public async Task <(bool newComponentsInserted, bool unusedComponentsDeleted)> SaveGenericNoiseComponents()
        {
            var newComponentsInserted   = false;
            var unusedComponentsDeleted = false;
            var noiseComponents         = await ImportGenericComponents();

            if (noiseComponents.Any())
            {
                var(componentsToInsert, componentsToDelete) = await GenericComponentsHaveChanged(noiseComponents);

                if (componentsToInsert.Any())
                {
                    await _genericComponentRepository.SaveGenericComponents(componentsToInsert);

                    newComponentsInserted = true;
                }

                if (componentsToDelete.Any())
                {
                    await _genericComponentRepository.DeleteGenericComponents(componentsToDelete);

                    unusedComponentsDeleted = true;
                }
            }

            return(newComponentsInserted, unusedComponentsDeleted);
        }