public void Test_FindStrategies_FindsAuthoriseReferenceMockPublicEntityStrategy()
        {
            StrategyScanner scanner = new StrategyScanner();

            string[] assemblyPaths = new string[] {
                Assembly.Load("SoftwareMonkeys.SiteStarter.Business.Tests").Location
            };

            scanner.AssemblyPaths = assemblyPaths;

            StrategyInfo[] strategies = scanner.FindStrategies(true);

            Assert.Greater(strategies.Length, 0);

            bool authoriseReferenceStrategyFound = false;

            string expectedTypeString = typeof(AuthoriseReferenceMockPublicEntityStrategy).FullName + ", " + typeof(AuthoriseReferenceMockPublicEntityStrategy).Assembly.GetName().Name;

            foreach (StrategyInfo strategy in strategies)
            {
                if (strategy is AuthoriseReferenceStrategyInfo)
                {
                    if (strategy.StrategyType == expectedTypeString)
                    {
                        authoriseReferenceStrategyFound = true;
                    }
                }
            }

            Assert.IsTrue(authoriseReferenceStrategyFound, "AuthoriseReferenceMockPublicEntityStrategy info not found.");
        }
        public void Test_ContainsEntities_NonMatchingAssembly_ExcludeTestStrategies()
        {
            Assembly assembly = Assembly.Load("SoftwareMonkeys.SiteStarter.Business.Tests");

            StrategyScanner scanner = new StrategyScanner();

            bool doesMatch = scanner.ContainsStrategies(assembly, false);

            Assert.IsFalse(doesMatch, "Matched when it shouldn't have.");
        }
        public void Test_ContainsEntities_MatchingAssembly_IncludeTestStrategies()
        {
            Assembly matchingAssembly = Assembly.Load("SoftwareMonkeys.SiteStarter.Business.Tests");

            StrategyScanner scanner = new StrategyScanner();

            bool doesMatch = scanner.ContainsStrategies(matchingAssembly, true);

            Assert.IsTrue(doesMatch, "Failed to match when it should.");
        }
        public void Test_FindStrategies()
        {
            StrategyScanner scanner = new StrategyScanner();

            string[] assemblyPaths = new string[] {
                Assembly.Load("SoftwareMonkeys.SiteStarter.Business").Location
            };

            scanner.AssemblyPaths = assemblyPaths;

            StrategyInfo[] strategies = scanner.FindStrategies();

            Assert.Greater(strategies.Length, 0);
        }
        public void Test_IsStrategy()
        {
            StrategyScanner scanner = new StrategyScanner();

            bool isStrategy = scanner.IsStrategy(typeof(RetrieveStrategy));

            bool notStrategy = scanner.IsStrategy(typeof(TestUser));

            Assert.IsTrue(isStrategy);
            Assert.IsFalse(notStrategy);
        }
        public void Test_FindStrategies_FindsAuthoriseReferenceStrategy()
        {
            StrategyScanner scanner = new StrategyScanner();

            string[] assemblyPaths = new string[] {
                Assembly.Load("SoftwareMonkeys.SiteStarter.Business.Tests").Location
            };

            scanner.AssemblyPaths = assemblyPaths;

            StrategyInfo[] strategies = scanner.FindStrategies(true);

            Assert.Greater(strategies.Length, 0);

            bool authoriseReferenceStrategyFound = false;

            foreach (StrategyInfo strategy in strategies)
            {
                if (strategy is AuthoriseReferenceStrategyInfo)
                    authoriseReferenceStrategyFound = true;
            }

            Assert.IsTrue(authoriseReferenceStrategyFound, "No authorise reference strategies found.");
        }