Example #1
0
        /// <summary>
        /// Tests that a scenario definition won't be built if the mappings don't have the same number of scenarios
        /// </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void ofMappingsDifferentNumberOfScenarios()
        public virtual void ofMappingsDifferentNumberOfScenarios()
        {
            PerturbationMapping <object>          mappingC = PerturbationMapping.of(FILTER_C, new TestPerturbation(27));
            IList <PerturbationMapping <object> > mappings = ImmutableList.of(MAPPING_A, MAPPING_B, mappingC);

            ScenarioDefinition.ofMappings(mappings);
        }
Example #2
0
        /// <summary>
        /// Tests that a scenario definition won't be built if the scenarios names are specified and there
        /// are the wrong number. The mappings all have 2 perturbations which should mean 2 scenarios, but
        /// there are 3 scenario names.
        /// </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void ofMappingsWrongNumberOfScenarioNames()
        public virtual void ofMappingsWrongNumberOfScenarioNames()
        {
            IList <PerturbationMapping <object> > mappings = ImmutableList.of(MAPPING_A, MAPPING_B, MAPPING_C);
            IList <string> scenarioNames = ImmutableList.of("foo", "bar", "baz");

            ScenarioDefinition.ofMappings(mappings, scenarioNames);
        }
Example #3
0
        /// <summary>
        /// Tests that exceptions are thrown when the scenario names contain duplicate values.
        /// </summary>
        public virtual void nonUniqueNames()
        {
            IList <PerturbationMapping <object> > mappings2 = ImmutableList.of(MAPPING_A, MAPPING_B, MAPPING_C);
            IList <string> names2 = ImmutableList.of("foo", "foo");
            string         msg2   = "Scenario names must be unique but duplicates were found: foo";

            assertThrows(() => ScenarioDefinition.ofMappings(mappings2, names2), typeof(System.ArgumentException), msg2);
        }
Example #4
0
        public virtual void ofMappingsWithNames()
        {
            IList <PerturbationMapping <object> > mappings = ImmutableList.of(MAPPING_A, MAPPING_B, MAPPING_C);
            IList <string>     scenarioNames      = ImmutableList.of("foo", "bar");
            ScenarioDefinition scenarioDefinition = ScenarioDefinition.ofMappings(mappings, scenarioNames);

            assertThat(scenarioDefinition.Mappings).isEqualTo(mappings);
            assertThat(scenarioDefinition.ScenarioNames).isEqualTo(scenarioNames);
        }
Example #5
0
        public virtual void repeatItems()
        {
            IList <int> inputs = ImmutableList.of(1, 2, 3, 4);

            IList <int> expected1 = ImmutableList.of(1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4);

            assertThat(ScenarioDefinition.repeatItems(inputs, 12, 1)).isEqualTo(expected1);

            IList <int> expected2 = ImmutableList.of(1, 1, 2, 2, 3, 3, 4, 4);

            assertThat(ScenarioDefinition.repeatItems(inputs, 8, 2)).isEqualTo(expected2);

            IList <int> expected3 = ImmutableList.of(1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4);

            assertThat(ScenarioDefinition.repeatItems(inputs, 12, 3)).isEqualTo(expected3);

            IList <int> expected4 = ImmutableList.of(1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4);

            assertThat(ScenarioDefinition.repeatItems(inputs, 24, 3)).isEqualTo(expected4);
        }