本文整理汇总了C#中IRule.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# IRule.Execute方法的具体用法?C# IRule.Execute怎么用?C# IRule.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRule
的用法示例。
在下文中一共展示了IRule.Execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WhenNoOrdersAreFoundThenNothingIsReturned
public void WhenNoOrdersAreFoundThenNothingIsReturned()
{
rule = new MultipleOrderRule(map, dishes2, output);
rule.Execute();
Assert.AreEqual(0, output.Count);
}
示例2: WhenASingleDishIsPresentThenTheOutputAccountsForThat
public void WhenASingleDishIsPresentThenTheOutputAccountsForThat()
{
dishes2.Add(3);
rule = new MultipleOrderRule(map, dishes2, output);
rule.Execute();
Assert.AreEqual(1, output.Count);
Assert.AreEqual("coffee", output[0]);
}
示例3: GivenASingleEntreeThenTheResultsAccountForThatFact
public void GivenASingleEntreeThenTheResultsAccountForThatFact()
{
dishes = new List<int>() { 1 };
output = new List<string>();
rule = new SingleOrderRule(map, dishes, output);
rule.Execute();
Assert.AreEqual(1, output.Count);
Assert.AreEqual("eggs", output[0]);
}
示例4: WhenAnEntreeSideAndDrinkExistThenTheResultsReflectThatFact
public void WhenAnEntreeSideAndDrinkExistThenTheResultsReflectThatFact()
{
dishes.Add(1);
dishes.Add(2);
dishes.Add(3);
rule = mealFactory.GetRules(map, dishes, output);
rule.Execute();
Assert.AreEqual(3, output.Count);
Assert.AreEqual("eggs", output[0]);
Assert.AreEqual("toast", output[1]);
Assert.AreEqual("coffee", output[2]);
}
示例5: WhenAnEntreeSideAndDrinkAreOutOfOrderTheResultsAreReturnedInTheCorrectOrder
public void WhenAnEntreeSideAndDrinkAreOutOfOrderTheResultsAreReturnedInTheCorrectOrder()
{
dishes.Add(2);
dishes.Add(1);
dishes.Add(3);
rule = mealFactory.GetRules(map, dishes, output);
rule.Execute();
Assert.AreEqual(3, output.Count);
Assert.AreEqual("eggs", output[0]);
Assert.AreEqual("toast", output[1]);
Assert.AreEqual("coffee", output[2]);
}
示例6: WhenAnEntreeSideDrinkAndDessertExistsThenTheResultsReflectThatFact
public void WhenAnEntreeSideDrinkAndDessertExistsThenTheResultsReflectThatFact()
{
dishes.Add(1);
dishes.Add(2);
dishes.Add(3);
dishes.Add(4);
rule = mealFactory.GetRules(map, dishes, output);
rule.Execute();
Assert.AreEqual(4, output.Count);
Assert.AreEqual("steak", output[0]);
Assert.AreEqual("potato", output[1]);
Assert.AreEqual("wine", output[2]);
Assert.AreEqual("cake", output[3]);
}
示例7: GivenMultipleBreakfastEntreesThenTheOutputAccountsForThat
public void GivenMultipleBreakfastEntreesThenTheOutputAccountsForThat()
{
dishes.Add(1);
dishes.Add(1);
rule = new SingleOrderRule(map, dishes, output);
try
{
rule.Execute();
}
catch (Exception e)
{
Debug.WriteLine(e.Message);
}
Assert.AreEqual(2, output.Count);
Assert.AreEqual("eggs", output[0]);
Assert.AreEqual("error", output[1]);
}
示例8: WhenAnEntreeSideDrinkAndInvalidRequestExistThenTheResultsReflectThatFact
public void WhenAnEntreeSideDrinkAndInvalidRequestExistThenTheResultsReflectThatFact()
{
dishes.Add(1);
dishes.Add(2);
dishes.Add(3);
dishes.Add(5);
rule = mealFactory.GetRules(map, dishes, output);
try
{
rule.Execute();
}
catch (Exception e)
{
Debug.WriteLine(e.Message);
}
Assert.AreEqual(4, output.Count);
Assert.AreEqual("steak", output[0]);
Assert.AreEqual("potato", output[1]);
Assert.AreEqual("wine", output[2]);
Assert.AreEqual("error", output[3]);
}
示例9: RunUnitTest
private static void RunUnitTest(IRule rule, ResultType resultType)
{
Assert.That(rule.Execute().Type, Is.EqualTo(resultType));
}
示例10: WhenAnEntreeSideDrinkAndOtherDishExistThenTheResultsReflectThatFact
public void WhenAnEntreeSideDrinkAndOtherDishExistThenTheResultsReflectThatFact()
{
dishes.Add(2);
dishes.Add(1);
dishes.Add(3);
dishes.Add(4);
rule = mealFactory.GetRules(map, dishes, output);
try
{
rule.Execute();
}
catch (Exception e)
{
Debug.WriteLine(e.Message);
}
Assert.AreEqual(4, output.Count);
Assert.AreEqual("eggs", output[0]);
Assert.AreEqual("toast", output[1]);
Assert.AreEqual("coffee", output[2]);
Assert.AreEqual("error", output[3]);
}
示例11: WhenTwoEntreesExistThenTheResultsReflectThatFact
public void WhenTwoEntreesExistThenTheResultsReflectThatFact()
{
dishes.Add(1);
dishes.Add(1);
rule = mealFactory.GetRules(map, dishes, output);
try
{
rule.Execute();
}
catch (Exception e)
{
Debug.WriteLine(e.Message);
}
Assert.AreEqual(2, output.Count);
Assert.AreEqual("eggs", output[0]);
Assert.AreEqual("error", output[1]);
}
示例12: WhenTwoEntreesExistThenAnExceptionIsThrown
public void WhenTwoEntreesExistThenAnExceptionIsThrown()
{
dishes.Add(1);
dishes.Add(1);
rule = mealFactory.GetRules(map, dishes, output);
rule.Execute();
}
示例13: WhenNoDishesExistThenNothingIsPrinted
public void WhenNoDishesExistThenNothingIsPrinted()
{
IList<int> dishes = new List<int>();
rule = mealFactory.GetRules(map, dishes, output);
rule.Execute();
Assert.AreEqual(0, output.Count);
}
示例14: WhenASingleEntreeExistsThenTheResultsReflectThatFact
public void WhenASingleEntreeExistsThenTheResultsReflectThatFact()
{
dishes.Add(1);
rule = mealFactory.GetRules(map, dishes, output);
rule.Execute();
Assert.AreEqual(1, output.Count);
Assert.AreEqual("eggs", output[0]);
}
示例15: RunUnitTest
private static void RunUnitTest(IRule rule, ResultType expectedResult)
{
Assert.That(rule.Execute().Type, Is.EqualTo(expectedResult));
}