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 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 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 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 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")); }