Esempio n. 1
0
        public void Constructor_WithoutValue_ExpectedValues(int numberOfDecimalPlaces)
        {
            // Call
            var roundedDouble = new RoundedDouble(numberOfDecimalPlaces);

            // Assert
            Assert.IsInstanceOf <IEquatable <RoundedDouble> >(roundedDouble);
            Assert.IsInstanceOf <IEquatable <double> >(roundedDouble);
            Assert.IsInstanceOf <IFormattable>(roundedDouble);
            Assert.IsInstanceOf <IComparable>(roundedDouble);
            Assert.IsInstanceOf <IComparable <RoundedDouble> >(roundedDouble);
            Assert.IsInstanceOf <IComparable <double> >(roundedDouble);
            Assert.AreEqual(numberOfDecimalPlaces, roundedDouble.NumberOfDecimalPlaces);
            Assert.AreEqual(0.0, roundedDouble.Value);

            TypeConverterAttribute[] typeAttributes = roundedDouble.GetType().GetCustomAttributes(typeof(TypeConverterAttribute), false)
                                                      .Cast <TypeConverterAttribute>()
                                                      .ToArray();
            Assert.AreEqual(1, typeAttributes.Length);
            Assert.AreEqual(new TypeConverterAttribute(typeof(RoundedDoubleConverter)), typeAttributes[0]);
        }