Exemple #1
0
        public void Test_EnumValueException_constructor_invalid_value_messageTemplate()
        {
            // Arrange
            var messageTemplate = "Customer message about: {0} - {1}";
            var value           = (MyEnumValueTestEnum)int.MaxValue;

            // Act
            var ex = new EnumValueException <MyEnumValueTestEnum>(value, messageTemplate);

            // Assert
            ex.ShouldNotBeNull();
            ex.Type.ShouldBe(value.GetType());
            ex.Message.ShouldBe(ex.Message.Replace("{0}", value.ToString()).Replace("{1}", value.GetType().Name));
        }
Exemple #2
0
        public void Test_EnumValueException_constructor_invalid_value()
        {
            // Arrange
            var value = (MyEnumValueTestEnum)int.MaxValue;

            // Act
            var ex = new EnumValueException <MyEnumValueTestEnum>(value);

            // Assert
            ex.ShouldNotBeNull();
            ex.Type.ShouldBe(value.GetType());
            ex.Value.ShouldBe(value);
            ex.Message.ShouldContain(typeof(MyEnumValueTestEnum).Name);
            ex.Message.ShouldContain(value.ToString());
        }