public void ThrowsExceptionOn_NonSerializableErrorInstances()
        {
            // Arrange
            var wrapperProvider = new SerializableErrorWrapperProvider();
            var person = new Person() { Id = 10, Name = "John" };
            var expectedMessage = string.Format("The object to be wrapped must be of type '{0}'" +
                                    " but was of type 'Person'.\r\nParameter name: original",
                                    typeof(SerializableErrorWrapper).Name);

            // Act and Assert
            var exception = Assert.Throws<ArgumentException>(() => wrapperProvider.Wrap(person));
            Assert.Equal(expectedMessage, exception.Message);
        }
示例#2
0
 public PersonWrapper(Person person)
 {
     Id = person.Id;
     Name = person.Name;
     Age = 35;
 }