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

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

            coverBeanEquals(test, test2);

            coverPrivateConstructor(typeof(MeasureHelper));
        }
 //-----------------------------------------------------------------------
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         ImmutableMeasure other = (ImmutableMeasure)obj;
         return(JodaBeanUtils.equal(name, other.name) && (currencyConvertible == other.currencyConvertible));
     }
     return(false);
 }
Exemple #3
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");
        }