private static void ParameterisedUnitTestForStandardDictionaryWithJustOneKey( OperationListBuilder operationListBuilder) { IDictionary <Key, Value> systemUnderTest = new Dictionary <Key, Value>(); Console.WriteLine("**** New Test Case ****"); foreach (var operation in operationListBuilder.Operations) { operation(systemUnderTest); } }
public void TestStandardDictionaryWithJustOneKey() { var keyFactory = TestVariable.Create(Enumerable.Range(-2, 5)); var operationFactory = TestVariable.Create( from operationKind in ((IEnumerable <OperationKind>) Enum.GetValues(typeof(OperationKind))) select operationKind); const Int32 numberOfOperations = 10; var randomBehaviour = new Random(0); var operationKindSequenceFactory = Synthesis.Create(Enumerable.Repeat(operationFactory, numberOfOperations)) .WithFilter(FilterOutThreeOrMoreConsecutiveIdenticalOperationKinds); var operationListBuilderFactory = Synthesis.Create(keyFactory, operationKindSequenceFactory, (key, operationKindSequence) => { var result = new OperationListBuilder(key, randomBehaviour); foreach (var operationKind in operationKindSequence) { result.AppendNewOperationOfKind(operationKind); } return(result); }); const Int32 strength = 4; var numberOfTestCasesExercised = operationListBuilderFactory.ExecuteParameterisedUnitTestForAllTestCases( strength, ParameterisedUnitTestForStandardDictionaryWithJustOneKey); Console.Out.WriteLine("Exercised {0} test cases.", numberOfTestCasesExercised); }