//-------------------------------------------------------------------------
        public virtual void coverage()
        {
            ImmutableMeasure test = ImmutableMeasure.of("A");

            coverImmutableBean(test);
            ImmutableMeasure test2 = ImmutableMeasure.of("B", false);

            coverBeanEquals(test, test2);

            coverPrivateConstructor(typeof(MeasureHelper));
        }
Exemple #2
0
        /// <summary>
        /// Tests that measure names are validated
        /// </summary>
        public virtual void namePattern()
        {
            assertThrows(() => ImmutableMeasure.of(null), typeof(System.ArgumentException));
            assertThrows(() => ImmutableMeasure.of(""), typeof(System.ArgumentException));
            assertThrows(() => ImmutableMeasure.of("Foo Bar"), typeof(System.ArgumentException), ".*must only contain the characters.*");
            assertThrows(() => ImmutableMeasure.of("Foo_Bar"), typeof(System.ArgumentException), ".*must only contain the characters.*");
            assertThrows(() => ImmutableMeasure.of("FooBar!"), typeof(System.ArgumentException), ".*must only contain the characters.*");

            // These should execute without throwing an exception
            ImmutableMeasure.of("FooBar");
            ImmutableMeasure.of("Foo-Bar");
            ImmutableMeasure.of("123");
            ImmutableMeasure.of("FooBar123");
        }