コード例 #1
0
            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");
            }
コード例 #2
0
            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");
            }
コード例 #3
0
            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"));
            }
コード例 #4
0
            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"));
            }
コード例 #5
0
            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"));
            }