public void Initialization_WithNullInnerException() { var columnDefinition = new UnsupportedStoragePropertyDefinition(typeof(int), "Message", null); Assert.That(columnDefinition.InnerException, Is.Null); Assert.That( () => columnDefinition.GetColumns(), Throws.TypeOf <NotSupportedException>().With.InnerException.Null); }
public void UnifyWithEquivalentProperties_ThrowsForDifferentExceptionType() { var property1 = new UnsupportedStoragePropertyDefinition(typeof(int), "x", new InvalidOperationException()); var property2 = new UnsupportedStoragePropertyDefinition(typeof(int), "x", new ArgumentException()); Assert.That( () => property1.UnifyWithEquivalentProperties(new[] { property2 }), Throws.ArgumentException.With.Message.EqualTo( "Only equivalent properties can be combined, but this property has inner exception type 'System.InvalidOperationException', and the " + "given property has inner exception type 'System.ArgumentException'.\r\nParameter name: equivalentProperties")); }
public void UnifyWithEquivalentProperties_ThrowsForDifferentMessage() { var exception = new Exception(); var property1 = new UnsupportedStoragePropertyDefinition(typeof(int), "x", exception); var property2 = new UnsupportedStoragePropertyDefinition(typeof(int), "y", exception); Assert.That( () => property1.UnifyWithEquivalentProperties(new[] { property2 }), Throws.ArgumentException.With.Message.EqualTo( "Only equivalent properties can be combined, but this property has message 'x', and the given property has " + "message 'y'.\r\nParameter name: equivalentProperties")); }
public void UnifyWithEquivalentProperties_CombinesProperties() { var property1 = new UnsupportedStoragePropertyDefinition(typeof(int), "x", new Exception()); var property2 = new UnsupportedStoragePropertyDefinition(typeof(int), "x", new Exception()); var property3 = new UnsupportedStoragePropertyDefinition(typeof(int), "x", new Exception()); var result = property1.UnifyWithEquivalentProperties(new[] { property2, property3 }); Assert.That( result, Is.TypeOf <UnsupportedStoragePropertyDefinition>().With.Property("PropertyType").SameAs(typeof(int))); Assert.That(((UnsupportedStoragePropertyDefinition)result).Message, Is.EqualTo("x")); Assert.That(((UnsupportedStoragePropertyDefinition)result).InnerException, Is.SameAs(property1.InnerException)); }
public void SetUp() { _innerException = new Exception("Inner!"); _unsupportedStorageProperty = new UnsupportedStoragePropertyDefinition(typeof(int), "Message", _innerException); }