BudgetAnalyser.Engine.UnitTest.DefaultIoCRegistrationsTest.EnsureAllInterfacesAreRegisteredWithIoC C# (CSharp) Method

EnsureAllInterfacesAreRegisteredWithIoC() private method

private EnsureAllInterfacesAreRegisteredWithIoC ( ) : void
return void
        public void EnsureAllInterfacesAreRegisteredWithIoC()
        {
            List<DependencyRegistrationRequirement> dependencies = DefaultIoCRegistrations.RegisterAutoMappingsFromAssembly(typeof(StatementModel).Assembly).ToList();
            dependencies.AddRange(DefaultIoCRegistrations.RegisterAutoMappingsFromAssembly(typeof(SecureStringCredentialStore).Assembly));

            IEnumerable<Type> interfaces = typeof(StatementModel).Assembly.GetTypes().Where(t => t.IsInterface);

            List<string> exemptionListNames = ExemptionList.Select(e => e.FullName).ToList();
            foreach (var interfaceType in interfaces.Except(ExemptionList))
            {
                Console.Write("Interface: {0}", interfaceType.Name);
                if (exemptionListNames.Contains(interfaceType.FullName)) continue;
                if (!dependencies.Any(d => d.AdditionalRegistrationType == interfaceType || IsSelfRegistered(interfaceType, d)))
                {
                    Assert.Fail($"Interface: {interfaceType.FullName} is not registered.");
                }

                Console.WriteLine(" registered.");
            }
        }