public void GetCombinatorial_CountTwo_PassOne()
            {
                CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>();
                testGenerator.Elements = CombinatorialGenerator_TestClass.GetCountTwoList();
                bool getResult = testGenerator.GetCombinatorials(1);

                Assert.IsTrue(getResult, "GetResult");
                Assert.AreEqual(1, testGenerator.TierCount, "TierCount");

                CombinatorialTier<string> resultTier = testGenerator.GetTier(1);
                List<string> expectedStrings = CombinatorialGenerator_TestClass.Get_CountTwo_TierOne_NoDegenerates();
                List<string> actualStrings = CombinatorialGenerator_TestClass.ConvertCombinatorialsToStringList(resultTier);

                CollectionAssert.AreEquivalent(expectedStrings, actualStrings, "Combinatorials");
            }
            public void ReportHandler_ReportingTest()
            {
                CombinatorialGenerator_TestClass handlerClass = new CombinatorialGenerator_TestClass();
                CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>();
                CombinatorialGenerator<string>.ReportOut reportHandler = handlerClass.HandleReport;
                CombinatorialTier<string> resultTier = null;
                List<string> expectedCombinatorials = CombinatorialGenerator_TestClass.Get_CountThree_TierThree_NoDegenerates();

                testGenerator.ReportingHandler = reportHandler;
                testGenerator.Elements = CombinatorialGenerator_TestClass.GetCountThreeList();
                bool getResult = testGenerator.GetCombinatorials(3);
                resultTier = testGenerator.GetTier(3);

                Assert.IsTrue(getResult);
                Assert.Greater(handlerClass.Combinatorials.Count, 0);
                Assert.IsNotNull(handlerClass.Tier);
                Assert.Greater(handlerClass.Tier.Tier.Count, 0);

                List<string> internalTierList = CombinatorialGenerator_TestClass.ConvertCombinatorialsToStringList(resultTier);
                List<string> externalTierList = CombinatorialGenerator_TestClass.ConvertCombinatorialsToStringList(handlerClass.Tier);
                List<string> externalCombinatorialList = CombinatorialGenerator_TestClass.ConvertCombinatorialsToStringList(handlerClass.Combinatorials);

                CollectionAssert.AreEquivalent(internalTierList, externalTierList);
                CollectionAssert.AreEquivalent(internalTierList, externalCombinatorialList);
            }
            public void ElementsPassed_Count2()
            {
                List<string> testList = new List<string>();
                testList.Add("A");
                testList.Add("B");

                CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>(testList);

                Assert.IsNotNull(testGenerator.Elements);
                Assert.AreEqual(1, testGenerator.MinimumTierValue);
                Assert.AreEqual(2, testGenerator.MaximumTierValue);
            }
            public void ErrorHandler_GetCombinatorials_TierMaxLessThanTierMin()
            {
                CombinatorialGenerator_TestClass handlerClass = new CombinatorialGenerator_TestClass();
                CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>();
                CombinatorialGenerator<string>.ErrorOut errorHandler = handlerClass.HandleError;

                testGenerator.ErrorHandler = errorHandler;
                testGenerator.Elements = CombinatorialGenerator_TestClass.GetCountTwoList();
                bool getResult = testGenerator.GetCombinatorials(2, 1);

                Assert.IsFalse(getResult);
                Assert.AreEqual(1, handlerClass.Errors.Count);
                Assert.IsTrue(handlerClass.ContainsError("TierMaxLessThanTierMin"));
            }
            public void GetTier_ElementsCountOne_PassTwo()
            {
                CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>();
                CombinatorialGenerator_TestClass handlerClass = new CombinatorialGenerator_TestClass();
                CombinatorialGenerator<string>.ErrorOut errorHandler = handlerClass.HandleError;
                CombinatorialTier<string> resultTier = null;

                testGenerator.ErrorHandler = errorHandler;
                testGenerator.Elements = CombinatorialGenerator_TestClass.GetCountOneList();
                bool getResult = testGenerator.GetCombinatorials();
                resultTier = testGenerator.GetTier(2);

                Assert.IsTrue(getResult);
                Assert.AreEqual(1, handlerClass.Errors.Count, "Errors.Count");
                Assert.IsTrue(handlerClass.ContainsError("TryGetTierPassedFailed"), "TryGetTierPassedFailed");
            }
 public void InitialState_ReportingOn()
 {
     CombinatorialGenerator<string> testGenerator =
         new CombinatorialGenerator<string>(new List<string>(CombinatorialGenerator_TestClass.GetCountTwoList()));
     Assert.IsFalse(testGenerator.ReportingOn);
 }
            public void ErrorHandler_ElementsIsNull()
            {
                CombinatorialGenerator_TestClass handlerClass = new CombinatorialGenerator_TestClass();
                CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>();
                CombinatorialGenerator<string>.ErrorOut errorHandler = handlerClass.HandleError;

                testGenerator.ErrorHandler = errorHandler;
                testGenerator.Elements = null;

                Assert.AreEqual(1, handlerClass.Errors.Count);
                Assert.IsTrue(handlerClass.ContainsError("ElementsIsNull"));
            }
 public void InitialState_CurrentRule()
 {
     CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>(null);
     Assert.AreEqual(CombinatorialRule.Strict, testGenerator.CurrentRule);
 }
 public void InitialState_ErrorsOn()
 {
     CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>(null);
     Assert.IsFalse(testGenerator.ErrorsOn);
 }
 public void InitialState_CurrentTierValue()
 {
     CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>(null);
     Assert.AreEqual(0, testGenerator.CurrentTierValue);
 }
 public void InitialState_Type()
 {
     CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>(null);
     Assert.AreEqual(typeof(string).ToString(), testGenerator.Type.ToString());
 }
            public void GetCombinatorial_Degenerates_CountTwo_PassThree_PassThree()
            {
                CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>();
                testGenerator.Elements = CombinatorialGenerator_TestClass.GetCountTwoList();
                testGenerator.CurrentRule = CombinatorialRule.PermutationsAllowed;
                bool getResult = testGenerator.GetCombinatorials(3, 3);

                Assert.IsTrue(getResult);
                Assert.AreEqual(1, testGenerator.TierCount);

                CombinatorialTier<string> resultTier = testGenerator.GetTier(3);
                List<string> expectedStrings = CombinatorialGenerator_TestClass.Get_CountTwo_TierThree_PermutationsAllowed();
                List<string> actualStrings = CombinatorialGenerator_TestClass.ConvertCombinatorialsToStringList(resultTier);
                CollectionAssert.AreEquivalent(expectedStrings, actualStrings);
            }
            public void GetCombinatorial_Degenerates_CountOne_PassOne_PassTwo()
            {
                CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>();
                testGenerator.Elements = CombinatorialGenerator_TestClass.GetCountOneList();
                testGenerator.CurrentRule = CombinatorialRule.DegeneratesAllowed;
                bool getResult = testGenerator.GetCombinatorials(1, 2);

                Assert.IsTrue(getResult);
                Assert.AreEqual(2, testGenerator.TierCount);

                CombinatorialTier<string> resultTier = testGenerator.GetTier(1);
                List<string> expectedStrings = CombinatorialGenerator_TestClass.Get_CountOne_TierOne_NoDegenerates();
                List<string> actualStrings = CombinatorialGenerator_TestClass.ConvertCombinatorialsToStringList(resultTier);
                CollectionAssert.AreEquivalent(expectedStrings, actualStrings);

                resultTier = testGenerator.GetTier(2);
                expectedStrings = CombinatorialGenerator_TestClass.Get_CountOne_TierTwo_DegeneratesAllowed();
                actualStrings = CombinatorialGenerator_TestClass.ConvertCombinatorialsToStringList(resultTier);
                CollectionAssert.AreEquivalent(expectedStrings, actualStrings);
            }
            public void GetCombinatorial_CountThree_PassTwo_PassThree()
            {
                CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>();
                testGenerator.Elements = CombinatorialGenerator_TestClass.GetCountThreeList();
                bool getResult = testGenerator.GetCombinatorials(2, 3);

                Assert.IsTrue(getResult);
                Assert.AreEqual(2, testGenerator.TierCount);

                CombinatorialTier<string> resultTier = testGenerator.GetTier(2);
                List<string> expectedStrings = CombinatorialGenerator_TestClass.Get_CountThree_TierTwo_NoDegenerates();
                List<string> actualStrings = CombinatorialGenerator_TestClass.ConvertCombinatorialsToStringList(resultTier);

                CollectionAssert.AreEquivalent(expectedStrings, actualStrings);

                resultTier = testGenerator.GetTier(3);
                expectedStrings = CombinatorialGenerator_TestClass.Get_CountThree_TierThree_NoDegenerates();
                actualStrings = CombinatorialGenerator_TestClass.ConvertCombinatorialsToStringList(resultTier);

                CollectionAssert.AreEquivalent(expectedStrings, actualStrings);
            }
 public void InitialState_CurrentRule()
 {
     CombinatorialGenerator<string> testGenerator =
         new CombinatorialGenerator<string>(new List<string>(CombinatorialGenerator_TestClass.GetCountTwoList()));
     Assert.AreEqual(CombinatorialRule.Strict, testGenerator.CurrentRule);
 }
 public void InitialState_Elements()
 {
     CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>(new List<string>());
     Assert.IsNotNull(testGenerator.Elements);
     Assert.AreEqual(0, testGenerator.Elements.Count);
 }
 public void InitialState_MaximumTierValue()
 {
     CombinatorialGenerator<string> testGenerator =
         new CombinatorialGenerator<string>(new List<string>(CombinatorialGenerator_TestClass.GetCountTwoList()));
     Assert.AreEqual(2, testGenerator.MaximumTierValue);
 }
 public void InitialState_MaximumTierValue()
 {
     CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>(new List<string>());
     Assert.AreEqual(0, testGenerator.MaximumTierValue);
 }
            public void ErrorHandler_Assignment()
            {
                CombinatorialGenerator_TestClass handlerClass = new CombinatorialGenerator_TestClass();
                CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>();
                CombinatorialGenerator<string>.ErrorOut errorHandler = handlerClass.HandleError;

                testGenerator.ErrorHandler = errorHandler;
                Assert.IsTrue(testGenerator.ErrorsOn);
            }
 public void InitialState_ReportingOn()
 {
     CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>(new List<string>());
     Assert.IsFalse(testGenerator.ReportingOn);
 }
            public void ErrorHandler_GetCombinatorials_ElementsIsEmpty()
            {
                CombinatorialGenerator_TestClass handlerClass = new CombinatorialGenerator_TestClass();
                CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>();
                CombinatorialGenerator<string>.ErrorOut errorHandler = handlerClass.HandleError;

                testGenerator.ErrorHandler = errorHandler;
                bool getResult = testGenerator.GetCombinatorials();

                Assert.IsFalse(getResult);
                Assert.AreEqual(1, handlerClass.Errors.Count);
                Assert.IsTrue(handlerClass.ContainsError("ElementsIsEmpty"));
            }
 public void InitialState_CurrentTierValue()
 {
     CombinatorialGenerator<string> testGenerator =
         new CombinatorialGenerator<string>(new List<string>(CombinatorialGenerator_TestClass.GetCountOneList()));
     Assert.AreEqual(1, testGenerator.CurrentTierValue);
 }
            public void ErrorHandler_GetCombinatorials_TierMaxGreaterThanElementsCount()
            {
                CombinatorialGenerator_TestClass handlerClass = new CombinatorialGenerator_TestClass();
                CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>();
                CombinatorialGenerator<string>.ErrorOut errorHandler = handlerClass.HandleError;

                testGenerator.ErrorHandler = errorHandler;
                testGenerator.Elements = CombinatorialGenerator_TestClass.GetCountTwoList();
                bool getResult = testGenerator.GetCombinatorials(1, 3);

                Assert.IsFalse(getResult, "Get Result");
                Assert.AreEqual(1, handlerClass.Errors.Count, "Errors.Count");
                Assert.IsTrue(handlerClass.ContainsError("TierMaxMoreThanElementsCount"), "Contains TierMaxMoreThanElementsCount");
            }
 public void InitialState_ErrorsOn()
 {
     CombinatorialGenerator<string> testGenerator =
         new CombinatorialGenerator<string>(new List<string>(CombinatorialGenerator_TestClass.GetCountOneList()));
     Assert.IsFalse(testGenerator.ErrorsOn);
 }
            public void HandlersPassed_ReportHandlerAssignment()
            {
                CombinatorialGenerator_TestClass handlerClass = new CombinatorialGenerator_TestClass();
                CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>();
                CombinatorialGenerator<string>.ReportOut reportHandler = handlerClass.HandleReport;

                testGenerator.ReportingHandler = reportHandler;

                Assert.IsTrue(testGenerator.ReportingOn);
            }
 public void InitialState_Elements()
 {
     CombinatorialGenerator<string> testGenerator =
         new CombinatorialGenerator<string>(new List<string>(CombinatorialGenerator_TestClass.GetCountTwoList()));
     Assert.IsNotNull(testGenerator.Elements);
     Assert.AreEqual(2, testGenerator.Elements.Count);
 }
            public void ElementsPassed_Empty()
            {
                List<string> testList = new List<string>();

                CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>(testList);

                Assert.IsNotNull(testGenerator.Elements);
                Assert.AreEqual(0, testGenerator.Elements.Count, testList.Count.ToString());
                Assert.AreEqual(0, testGenerator.MinimumTierValue, "MinimumTierValue");
                Assert.AreEqual(0, testGenerator.MaximumTierValue, "MaximumTierValue");
                Assert.AreEqual(0, testGenerator.TierCount, "TierCount");
            }
 public void InitialState_Type()
 {
     CombinatorialGenerator<string> testGenerator =
         new CombinatorialGenerator<string>(new List<string>(CombinatorialGenerator_TestClass.GetCountTwoList()));
     Assert.AreEqual(typeof(string).ToString(), testGenerator.Type.ToString());
 }
 public void CombinatorialGenerator_CurrentRule_GetAndSet()
 {
     CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>();
     testGenerator.CurrentRule = CombinatorialRule.DegeneratesAllowed;
     Assert.AreEqual(CombinatorialRule.DegeneratesAllowed, testGenerator.CurrentRule);
     testGenerator.CurrentRule = CombinatorialRule.PermutationsAllowed;
     Assert.AreEqual(CombinatorialRule.PermutationsAllowed, testGenerator.CurrentRule);
     testGenerator.CurrentRule = CombinatorialRule.Strict;
     Assert.AreEqual(CombinatorialRule.Strict, testGenerator.CurrentRule);
 }
            public void GetTier_ElementsCountOne_PassTwo()
            {
                CombinatorialGenerator<string> testGenerator = new CombinatorialGenerator<string>();
                CombinatorialTier<string> resultTier = null;

                testGenerator.Elements = CombinatorialGenerator_TestClass.GetCountOneList();
                testGenerator.GetCombinatorials();
                resultTier = testGenerator.GetTier(2);

                Assert.IsNotNull(resultTier, "ResultTier");
                Assert.AreEqual(0, resultTier.Tier.Count, "Tier.Count");
            }