Index: Core/Common/src/Core.Common.Base/Geometry/Point2D.cs
===================================================================
diff -u -r065af7e201b59ec19a17c42e9d772f5e86b31338 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Base/Geometry/Point2D.cs (.../Point2D.cs) (revision 065af7e201b59ec19a17c42e9d772f5e86b31338)
+++ Core/Common/src/Core.Common.Base/Geometry/Point2D.cs (.../Point2D.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -60,8 +60,19 @@
/// Head of the vector.
/// Tail of the vector.
/// A 2D vector.
+ /// Thrown when either
+ /// or is null.
public static Vector operator -(Point2D p1, Point2D p2)
{
+ if (p1 == null)
+ {
+ throw new ArgumentNullException("p1");
+ }
+ if (p2 == null)
+ {
+ throw new ArgumentNullException("p2");
+ }
+
var result = new DenseVector(2);
result[0] = p1.X - p2.X;
result[1] = p1.Y - p2.Y;
@@ -76,10 +87,21 @@
///
/// A 2D point.
///
- /// Thrown when is
+ /// Thrown when is
/// not a 2D vector.
+ /// Thrown when
+ /// or is null.
public static Point2D operator +(Point2D point, Vector vector)
{
+ if (point == null)
+ {
+ throw new ArgumentNullException("point");
+ }
+ if (vector == null)
+ {
+ throw new ArgumentNullException("vector");
+ }
+
if (vector.Count != 2)
{
string message = string.Format(CultureInfo.CurrentCulture,
Index: Core/Common/src/Core.Common.Base/Geometry/Segment2D.cs
===================================================================
diff -u -r046663d502bb3383e16aac1267f1a7e1480e558e -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Base/Geometry/Segment2D.cs (.../Segment2D.cs) (revision 046663d502bb3383e16aac1267f1a7e1480e558e)
+++ Core/Common/src/Core.Common.Base/Geometry/Segment2D.cs (.../Segment2D.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -148,13 +148,19 @@
///
/// The segment which may be connected to the .
/// true if the segments are connected. false otherwise.
+ /// Thrown when
+ /// is null .
public bool IsConnected(Segment2D segment)
{
- return
- FirstPoint.Equals(segment.FirstPoint) ||
- FirstPoint.Equals(segment.SecondPoint) ||
- SecondPoint.Equals(segment.FirstPoint) ||
- SecondPoint.Equals(segment.SecondPoint);
+ if (segment == null)
+ {
+ throw new ArgumentNullException("segment");
+ }
+
+ return FirstPoint.Equals(segment.FirstPoint) ||
+ FirstPoint.Equals(segment.SecondPoint) ||
+ SecondPoint.Equals(segment.FirstPoint) ||
+ SecondPoint.Equals(segment.SecondPoint);
}
public override bool Equals(object obj)
Index: Core/Common/src/Core.Common.Gui/Attributes/DynamicVisibleAttribute.cs
===================================================================
diff -u -r065af7e201b59ec19a17c42e9d772f5e86b31338 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Gui/Attributes/DynamicVisibleAttribute.cs (.../DynamicVisibleAttribute.cs) (revision 065af7e201b59ec19a17c42e9d772f5e86b31338)
+++ Core/Common/src/Core.Common.Gui/Attributes/DynamicVisibleAttribute.cs (.../DynamicVisibleAttribute.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -42,27 +42,27 @@
///
/// Determines whether the property is visible or not.
///
- /// The object.
- /// The name of the property of .
+ /// The object.
+ /// The name of the property of .
/// True if the property is visible, false otherwise.
/// Thrown when
- /// does not correspond to a public property of .
+ /// does not correspond to a public property of .
/// Thrown when there isn't a single method
- /// declared on marked with
+ /// declared on marked with
/// that is matching the signature defined by .
- public static bool IsVisible(object obj, string propertyName)
+ public static bool IsVisible(object value, string propertyName)
{
if (string.IsNullOrEmpty(propertyName))
{
return BrowsableAttribute.Default.Browsable;
}
- if (!IsPropertyDynamicallyVisible(obj, propertyName))
+ if (!IsPropertyDynamicallyVisible(value, propertyName))
{
return BrowsableAttribute.Default.Browsable;
}
- var isPropertyVisibleDelegate = DynamicVisibleValidationMethodAttribute.CreateIsVisibleMethod(obj);
+ var isPropertyVisibleDelegate = DynamicVisibleValidationMethodAttribute.CreateIsVisibleMethod(value);
return isPropertyVisibleDelegate(propertyName);
}
Index: Core/Common/src/Core.Common.Gui/Commands/IViewCommands.cs
===================================================================
diff -u -r223b2a4edc4ac816051c7eeecb735c34a6246574 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Gui/Commands/IViewCommands.cs (.../IViewCommands.cs) (revision 223b2a4edc4ac816051c7eeecb735c34a6246574)
+++ Core/Common/src/Core.Common.Gui/Commands/IViewCommands.cs (.../IViewCommands.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -36,22 +36,22 @@
///
/// Open the view for the given data object.
///
- /// The data object for which a view must be opened.
+ /// The data object for which a view must be opened.
/// If multiple views are available, the user is asked which view to use.
///
- void OpenView(object dataObject);
+ void OpenView(object viewData);
///
/// Removes all views that are associated to the given data object and/or its children.
///
- /// The root data object for which all views must be closed.
- void RemoveAllViewsForItem(object dataObject);
+ /// The root data object for which all views must be closed.
+ void RemoveAllViewsForItem(object viewData);
///
/// Indicates if a there are any views available for the application's selection.
///
- /// The data object to open views for.
- /// True if there are any views for , false otherwise.
- bool CanOpenViewFor(object dataObject);
+ /// The data object to open views for.
+ /// True if there are any views for , false otherwise.
+ bool CanOpenViewFor(object viewData);
}
}
\ No newline at end of file
Index: Core/Common/src/Core.Common.Gui/Commands/ViewCommandHandler.cs
===================================================================
diff -u -r1eed3e3f652618c52a462edc502cfd4250772314 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Gui/Commands/ViewCommandHandler.cs (.../ViewCommandHandler.cs) (revision 1eed3e3f652618c52a462edc502cfd4250772314)
+++ Core/Common/src/Core.Common.Gui/Commands/ViewCommandHandler.cs (.../ViewCommandHandler.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -53,29 +53,29 @@
OpenView(applicationSelection.Selection);
}
- public bool CanOpenViewFor(object dataObject)
+ public bool CanOpenViewFor(object viewData)
{
- return viewController.DocumentViewController.GetViewInfosFor(dataObject).Any();
+ return viewController.DocumentViewController.GetViewInfosFor(viewData).Any();
}
- public void OpenView(object dataObject)
+ public void OpenView(object viewData)
{
- viewController.DocumentViewController.OpenViewForData(dataObject);
+ viewController.DocumentViewController.OpenViewForData(viewData);
}
- public void RemoveAllViewsForItem(object dataObject)
+ public void RemoveAllViewsForItem(object viewData)
{
- if (dataObject == null || viewController.ViewHost == null)
+ if (viewData == null || viewController.ViewHost == null)
{
return;
}
var objectsToRemoveViewsFor = new List
{
- dataObject
+ viewData
};
- objectsToRemoveViewsFor.AddRange(pluginsHost.GetAllDataWithViewDefinitionsRecursively(dataObject).Cast());
+ objectsToRemoveViewsFor.AddRange(pluginsHost.GetAllDataWithViewDefinitionsRecursively(viewData).Cast());
foreach (var data in objectsToRemoveViewsFor)
{
Index: Core/Common/src/Core.Common.Gui/ContextMenu/IContextMenuBuilderProvider.cs
===================================================================
diff -u -r24da3aa72ccc0776599628c9f971081694048d9a -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Gui/ContextMenu/IContextMenuBuilderProvider.cs (.../IContextMenuBuilderProvider.cs) (revision 24da3aa72ccc0776599628c9f971081694048d9a)
+++ Core/Common/src/Core.Common.Gui/ContextMenu/IContextMenuBuilderProvider.cs (.../IContextMenuBuilderProvider.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -31,16 +31,16 @@
{
///
/// Returns a new for creating a
- /// for the given .
+ /// for the given .
///
- /// The data object to have the
+ /// The data object to have the
/// create a for.
/// The to use while executing the
/// actions.
/// The which can be used to create a
- /// for .
+ /// for .
/// Thrown when the instance could
/// not be created.
- IContextMenuBuilder Get(object dataObject, TreeViewControl treeViewControl);
+ IContextMenuBuilder Get(object value, TreeViewControl treeViewControl);
}
}
\ No newline at end of file
Index: Core/Common/src/Core.Common.Gui/Forms/MessageWindow/IMessageWindow.cs
===================================================================
diff -u -rbe66e1bec38a780abb27fedea8632acf4d24a173 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Gui/Forms/MessageWindow/IMessageWindow.cs (.../IMessageWindow.cs) (revision be66e1bec38a780abb27fedea8632acf4d24a173)
+++ Core/Common/src/Core.Common.Gui/Forms/MessageWindow/IMessageWindow.cs (.../IMessageWindow.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -36,6 +36,7 @@
/// Type of logging message.
/// Time when the message was logged.
/// The message text.
+ /// Throw when is null .
void AddMessage(Level level, DateTime time, string message);
}
}
\ No newline at end of file
Index: Core/Common/src/Core.Common.Gui/Forms/MessageWindow/MessageWindow.cs
===================================================================
diff -u -r49c5da81f49a23dd6e66526d264a08bf510e6963 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Gui/Forms/MessageWindow/MessageWindow.cs (.../MessageWindow.cs) (revision 49c5da81f49a23dd6e66526d264a08bf510e6963)
+++ Core/Common/src/Core.Common.Gui/Forms/MessageWindow/MessageWindow.cs (.../MessageWindow.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -101,6 +101,11 @@
public void AddMessage(Level level, DateTime time, string message)
{
+ if (level == null)
+ {
+ throw new ArgumentNullException("level");
+ }
+
string shortMessage;
using (var reader = new StringReader(message))
{
Index: Core/Common/src/Core.Common.Gui/Forms/ProgressDialog/ProgressReporter.cs
===================================================================
diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Gui/Forms/ProgressDialog/ProgressReporter.cs (.../ProgressReporter.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71)
+++ Core/Common/src/Core.Common.Gui/Forms/ProgressDialog/ProgressReporter.cs (.../ProgressReporter.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -63,8 +63,14 @@
/// The task to monitor for completion.
/// The action to take when the task has completed, in the context of the UI thread.
/// The continuation created to handle completion. This is normally ignored.
+ /// Thrown when is null .
public void RegisterContinuation(Task task, Action action)
{
+ if (task == null)
+ {
+ throw new ArgumentNullException("task");
+ }
+
task.ContinueWith(_ => action(), CancellationToken.None, TaskContinuationOptions.None, scheduler);
}
}
Index: Core/Common/src/Core.Common.Gui/Forms/PropertyGridView/PropertyGridView.cs
===================================================================
diff -u -re7e22e69b16b23c89c063f18444c82aa818dc176 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Gui/Forms/PropertyGridView/PropertyGridView.cs (.../PropertyGridView.cs) (revision e7e22e69b16b23c89c063f18444c82aa818dc176)
+++ Core/Common/src/Core.Common.Gui/Forms/PropertyGridView/PropertyGridView.cs (.../PropertyGridView.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -56,8 +56,18 @@
/// The application selection mechanism.
/// The class responsible for finding the object properties
/// for a given data object.
+ /// Thrown when any input argument is null .
public PropertyGridView(IApplicationSelection applicationSelection, IPropertyResolver propertyResolver)
{
+ if (applicationSelection == null)
+ {
+ throw new ArgumentNullException("applicationSelection");
+ }
+ if (propertyResolver == null)
+ {
+ throw new ArgumentNullException("propertyResolver");
+ }
+
HideTabsButton();
DisableDescriptionAreaAutoSizing();
TranslateToolTips();
Index: Core/Common/src/Core.Common.Gui/GuiCore.cs
===================================================================
diff -u -r8805f03189f521994b42a519bbca7561bf12eb68 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Gui/GuiCore.cs (.../GuiCore.cs) (revision 8805f03189f521994b42a519bbca7561bf12eb68)
+++ Core/Common/src/Core.Common.Gui/GuiCore.cs (.../GuiCore.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -193,7 +193,7 @@
#region Implementation: IContextMenuBuilderProvider
- public IContextMenuBuilder Get(object dataObject, TreeViewControl treeViewControl)
+ public IContextMenuBuilder Get(object value, TreeViewControl treeViewControl)
{
if (applicationFeatureCommands == null)
{
@@ -204,7 +204,7 @@
importCommandHandler,
exportCommandHandler,
ViewCommands,
- dataObject,
+ value,
treeViewControl);
}
@@ -690,14 +690,14 @@
return Plugins.SelectMany(pluginGui => pluginGui.GetTreeNodeInfos());
}
- public IEnumerable GetAllDataWithViewDefinitionsRecursively(object rootDataObject)
+ public IEnumerable GetAllDataWithViewDefinitionsRecursively(object rootValue)
{
var resultSet = new HashSet();
- foreach (var childDataInstance in Plugins.SelectMany(p => p.GetChildDataWithViewDefinitions(rootDataObject)).Distinct())
+ foreach (var childDataInstance in Plugins.SelectMany(p => p.GetChildDataWithViewDefinitions(rootValue)).Distinct())
{
resultSet.Add(childDataInstance);
- if (!ReferenceEquals(rootDataObject, childDataInstance))
+ if (!ReferenceEquals(rootValue, childDataInstance))
{
foreach (var dataWithViewDefined in GetAllDataWithViewDefinitionsRecursively(childDataInstance))
{
Index: Core/Common/src/Core.Common.Gui/IPluginsHost.cs
===================================================================
diff -u -r1eed3e3f652618c52a462edc502cfd4250772314 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Gui/IPluginsHost.cs (.../IPluginsHost.cs) (revision 1eed3e3f652618c52a462edc502cfd4250772314)
+++ Core/Common/src/Core.Common.Gui/IPluginsHost.cs (.../IPluginsHost.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -41,9 +41,9 @@
/// Queries the plugins to get all data with view definitions recursively, given a
/// piece of hierarchical data.
///
- /// The root data object.
+ /// The root data object.
/// An enumeration of all (child)data that have view definitions declared.
- IEnumerable GetAllDataWithViewDefinitionsRecursively(object rootDataObject);
+ IEnumerable GetAllDataWithViewDefinitionsRecursively(object rootValue);
///
/// Retrieves all the defined on the configured plugins.
Index: Core/Common/src/Core.Common.Gui/Plugin/PluginBase.cs
===================================================================
diff -u -r1a49563c568eaef8b84743fec1f04ee119bf5c9c -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Gui/Plugin/PluginBase.cs (.../PluginBase.cs) (revision 1a49563c568eaef8b84743fec1f04ee119bf5c9c)
+++ Core/Common/src/Core.Common.Gui/Plugin/PluginBase.cs (.../PluginBase.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -102,9 +102,9 @@
/// Gets the child data instances that have definitions of
/// some parent data object.
///
- /// The parent data object.
+ /// The parent data object.
/// Sequence of child data.
- public virtual IEnumerable GetChildDataWithViewDefinitions(object dataObject)
+ public virtual IEnumerable GetChildDataWithViewDefinitions(object viewData)
{
yield break;
}
Index: Core/Common/src/Core.Common.Gui/Plugin/PropertyInfoExtensions.cs
===================================================================
diff -u -r24da3aa72ccc0776599628c9f971081694048d9a -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Gui/Plugin/PropertyInfoExtensions.cs (.../PropertyInfoExtensions.cs) (revision 24da3aa72ccc0776599628c9f971081694048d9a)
+++ Core/Common/src/Core.Common.Gui/Plugin/PropertyInfoExtensions.cs (.../PropertyInfoExtensions.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -35,8 +35,15 @@
///
/// The property information used to create the object properties.
/// Data that will be set to the created object properties instance.
+ /// Thrown when
+ /// is null .
public static IObjectProperties CreateObjectProperties(this PropertyInfo propertyInfo, object sourceData)
{
+ if (propertyInfo == null)
+ {
+ throw new ArgumentNullException("propertyInfo");
+ }
+
var objectProperties = (IObjectProperties) Activator.CreateInstance(propertyInfo.PropertyObjectType);
objectProperties.Data = propertyInfo.GetObjectPropertiesData != null
Index: Core/Common/src/Core.Common.Gui/PropertyBag/DynamicPropertyBag.cs
===================================================================
diff -u -r76c6f433b6291cb6289f3c9e1df08c5491b7869d -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Gui/PropertyBag/DynamicPropertyBag.cs (.../DynamicPropertyBag.cs) (revision 76c6f433b6291cb6289f3c9e1df08c5491b7869d)
+++ Core/Common/src/Core.Common.Gui/PropertyBag/DynamicPropertyBag.cs (.../DynamicPropertyBag.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -50,8 +50,15 @@
/// object and exposing properties for that object.
///
/// The object to be wrapped.
+ /// Thrown when
+ /// is null .
public DynamicPropertyBag(object propertyObject)
{
+ if (propertyObject == null)
+ {
+ throw new ArgumentNullException("propertyObject");
+ }
+
Properties = new HashSet();
WrappedObject = propertyObject;
Index: Core/Common/src/Core.Common.Gui/PropertyBag/PropertySpec.cs
===================================================================
diff -u -r065af7e201b59ec19a17c42e9d772f5e86b31338 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Gui/PropertyBag/PropertySpec.cs (.../PropertySpec.cs) (revision 065af7e201b59ec19a17c42e9d772f5e86b31338)
+++ Core/Common/src/Core.Common.Gui/PropertyBag/PropertySpec.cs (.../PropertySpec.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -44,8 +44,13 @@
/// The property information.
/// Thrown when is
/// an index property.
+ /// When is null .
public PropertySpec(PropertyInfo propertyInfo)
{
+ if (propertyInfo == null)
+ {
+ throw new ArgumentNullException("propertyInfo");
+ }
if (propertyInfo.GetIndexParameters().Length > 0)
{
throw new ArgumentException(@"Index properties are not allowed.", "propertyInfo");
Index: Core/Common/src/Core.Common.Gui/PropertyBag/PropertySpecDescriptor.cs
===================================================================
diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Gui/PropertyBag/PropertySpecDescriptor.cs (.../PropertySpecDescriptor.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71)
+++ Core/Common/src/Core.Common.Gui/PropertyBag/PropertySpecDescriptor.cs (.../PropertySpecDescriptor.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -45,8 +45,10 @@
///
/// The property spec.
/// The instance which has the property captured in .
+ /// Thrown when
+ /// is null .
public PropertySpecDescriptor(PropertySpec propertySpec, object instance)
- : base(propertySpec.Name, propertySpec.Attributes)
+ : base(ValidateNotNull(propertySpec).Name, propertySpec.Attributes)
{
item = propertySpec;
this.instance = instance;
@@ -121,5 +123,14 @@
{
return false;
}
+
+ private static PropertySpec ValidateNotNull(PropertySpec propertySpec)
+ {
+ if (propertySpec == null)
+ {
+ throw new ArgumentNullException("propertySpec");
+ }
+ return propertySpec;
+ }
}
}
\ No newline at end of file
Index: Core/Common/src/Core.Common.Utils/Drawing/GraphicsExtensions.cs
===================================================================
diff -u -rb7c2e788d70b36d8fdabb8b7f56e2184df85b550 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Utils/Drawing/GraphicsExtensions.cs (.../GraphicsExtensions.cs) (revision b7c2e788d70b36d8fdabb8b7f56e2184df85b550)
+++ Core/Common/src/Core.Common.Utils/Drawing/GraphicsExtensions.cs (.../GraphicsExtensions.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -39,10 +39,20 @@
/// The x-coordinate of the upper-left corner of the drawn image.
/// The y-coordinate of the upper-left corner of the drawn image.
/// The opacity for the image.
- /// Thrown when is null .
+ /// Thrown when or
+ /// is null .
///
public static void DrawImageTransparent(this Graphics g, Image image, int x, int y, float opacity)
{
+ if (g == null)
+ {
+ throw new ArgumentNullException("g");
+ }
+ if (image == null)
+ {
+ throw new ArgumentNullException("image");
+ }
+
var width = image.Width;
var height = image.Height;
g.DrawImage(image, new Rectangle(0, 0, width, height), x, y,
Index: Core/Common/src/Core.Common.Utils/Extensions/CollectionExtensions.cs
===================================================================
diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Utils/Extensions/CollectionExtensions.cs (.../CollectionExtensions.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71)
+++ Core/Common/src/Core.Common.Utils/Extensions/CollectionExtensions.cs (.../CollectionExtensions.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -35,12 +35,18 @@
///
/// The type of the elements in the collection.
/// The collection from which elements should be removed.
- /// The filtering method, that should return true if the
+ /// The filtering method, that should return true if the
/// given element should be removed from .
- public static void RemoveAllWhere(this ICollection source, Func condition)
+ /// Thrown when any input argument is null .
+ public static void RemoveAllWhere(this ICollection source, Func predicate)
{
- foreach (T item in source.Where(condition).ToArray())
+ if (source == null)
{
+ throw new ArgumentNullException("source");
+ }
+
+ foreach (T item in source.Where(predicate).ToArray())
+ {
source.Remove(item);
}
}
Index: Core/Common/src/Core.Common.Utils/Extensions/EnumerableExtensions.cs
===================================================================
diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Utils/Extensions/EnumerableExtensions.cs (.../EnumerableExtensions.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71)
+++ Core/Common/src/Core.Common.Utils/Extensions/EnumerableExtensions.cs (.../EnumerableExtensions.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -37,8 +37,18 @@
/// A sequence that contains elements to be acted upon.
/// The action that should be performed on each element.
/// Do not define an action that effect .
+ /// When any input argument is null .
public static void ForEachElementDo(this IEnumerable source, Action action)
{
+ if (source == null)
+ {
+ throw new ArgumentNullException("source");
+ }
+ if (action == null)
+ {
+ throw new ArgumentNullException("action");
+ }
+
foreach (var item in source)
{
action(item);
Index: Core/Common/src/Core.Common.Utils/IO/EmbeddedResourceFileWriter.cs
===================================================================
diff -u -rb7c2e788d70b36d8fdabb8b7f56e2184df85b550 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Utils/IO/EmbeddedResourceFileWriter.cs (.../EmbeddedResourceFileWriter.cs) (revision b7c2e788d70b36d8fdabb8b7f56e2184df85b550)
+++ Core/Common/src/Core.Common.Utils/IO/EmbeddedResourceFileWriter.cs (.../EmbeddedResourceFileWriter.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -44,8 +44,18 @@
/// (temporary) write to the Windows Temp directory.
/// Thrown when an embedded resource file in
/// cannot be found in .
+ /// Thrown when any input argument is null .
public EmbeddedResourceFileWriter(Assembly assembly, bool removeFilesOnDispose, params string[] embeddedResourceFileNames)
{
+ if (assembly == null)
+ {
+ throw new ArgumentNullException("assembly");
+ }
+ if (embeddedResourceFileNames == null)
+ {
+ throw new ArgumentNullException("embeddedResourceFileNames");
+ }
+
this.removeFilesOnDispose = removeFilesOnDispose;
targetFolderPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
Index: Core/Common/src/Core.Common.Utils/Reflection/AssemblyUtils.cs
===================================================================
diff -u -r49c5da81f49a23dd6e66526d264a08bf510e6963 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Utils/Reflection/AssemblyUtils.cs (.../AssemblyUtils.cs) (revision 49c5da81f49a23dd6e66526d264a08bf510e6963)
+++ Core/Common/src/Core.Common.Utils/Reflection/AssemblyUtils.cs (.../AssemblyUtils.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -37,8 +37,15 @@
///
/// The assembly to read.
/// A structure containing all the assembly info provided.
+ /// Thrown when
+ /// is null .
public static AssemblyInfo GetAssemblyInfo(Assembly assembly)
{
+ if (assembly == null)
+ {
+ throw new ArgumentNullException("assembly");
+ }
+
AssemblyInfo info = new AssemblyInfo();
if (string.IsNullOrEmpty(assembly.Location))
@@ -97,6 +104,8 @@
/// The matching the string name, null otherwise.
/// Thrown when the specified type string is
/// found in multiple assemblies.
+ /// Thrown when
+ /// is null .
public static Type GetTypeByName(string typeName)
{
Type result = null;
@@ -128,8 +137,15 @@
/// The byte-stream to the embedded resource.
/// Thrown when the embedded resource file with
/// name cannot be found in .
+ /// Thrown when
+ /// is null .
public static Stream GetAssemblyResourceStream(Assembly assembly, string fileName)
{
+ if (assembly == null)
+ {
+ throw new ArgumentNullException("assembly");
+ }
+
try
{
return assembly.GetManifestResourceNames()
Index: Core/Common/src/Core.Common.Utils/Reflection/TypeUtils.cs
===================================================================
diff -u -r49c5da81f49a23dd6e66526d264a08bf510e6963 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/src/Core.Common.Utils/Reflection/TypeUtils.cs (.../TypeUtils.cs) (revision 49c5da81f49a23dd6e66526d264a08bf510e6963)
+++ Core/Common/src/Core.Common.Utils/Reflection/TypeUtils.cs (.../TypeUtils.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -54,8 +54,13 @@
/// True if is the same type as ,
/// or has that as (one of) its supertypes.
///
+ /// Thrown when is null .
public static bool Implements(this Type thisType, Type type)
{
+ if (type == null)
+ {
+ throw new ArgumentNullException("type");
+ }
return type.IsAssignableFrom(thisType);
}
@@ -67,8 +72,13 @@
/// The string name of the member.
/// Thrown when
/// is not an expression with a member, such as an expression calling multiple methods.
+ /// Thrown when is null .
public static string GetMemberName(Expression> expression)
{
+ if (expression == null)
+ {
+ throw new ArgumentNullException("expression");
+ }
return GetMemberName(expression, expression.Body);
}
@@ -80,8 +90,13 @@
/// The string name of the member.
/// Thrown when
/// is not an expression with a member, such as an expression calling multiple methods.
+ /// Thrown when is null .
public static string GetMemberName(Expression> expression)
{
+ if (expression == null)
+ {
+ throw new ArgumentNullException("expression");
+ }
return GetMemberName(expression, expression.Body);
}
@@ -94,10 +109,14 @@
/// The value of the field.
/// Thrown when
/// doesn't have a field with the name .
- /// Thrown when is null .
+ /// Thrown when any input argument is null .
/// This method can be used for fields of any visibility.
public static T GetField(object instance, string fieldName)
{
+ if (instance == null)
+ {
+ throw new ArgumentNullException("instance");
+ }
FieldInfo fieldInfo = GetFieldInfo(instance.GetType(), fieldName);
if (fieldInfo == null)
{
@@ -116,10 +135,16 @@
/// Thrown when
/// doesn't have a field with the name .
/// Thrown when is of incorrect type.
- /// Thrown when is null .
+ /// Thrown when
+ /// or is null .
/// This method can be used for fields of any visibility.
public static void SetField(object obj, string fieldName, object newValue)
{
+ if (obj == null)
+ {
+ throw new ArgumentNullException("obj");
+ }
+
FieldInfo fieldInfo = GetFieldInfo(obj.GetType(), fieldName);
if (fieldInfo == null)
{
@@ -146,10 +171,16 @@
/// property returns true for the declaring type.
/// Thrown when more than one method is found with
/// the specified name and matching the specified binding constraints.
- /// Thrown when is null .
+ /// Thrown when
+ /// or is null .
/// The return value of the method.
public static T CallPrivateMethod(object instance, string methodName, params object[] arguments)
{
+ if (instance == null)
+ {
+ throw new ArgumentNullException("instance");
+ }
+
var methodInfo = instance.GetType().GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Instance);
if (methodInfo == null)
{
@@ -175,9 +206,15 @@
/// property returns true for the declaring type.
/// Thrown when more than one method is found with
/// the specified name and matching the specified binding constraints.
- /// Thrown when is null .
+ /// Thrown when
+ /// or is null .
public static void CallPrivateMethod(object instance, string methodName, params object[] arguments)
{
+ if (instance == null)
+ {
+ throw new ArgumentNullException("instance");
+ }
+
var methodInfo = instance.GetType().GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Instance);
if (methodInfo == null)
{
@@ -193,7 +230,8 @@
/// The instance declaring the property. Cannot be null .
/// Name of the property to be set.
/// The new value of the property.
- /// Thrown when is null .
+ /// Thrown when
+ /// or is null .
/// Thrown when the property referred to by
/// is not declared or inherited by the class of .
/// Thrown when the property has not setter.
@@ -204,6 +242,11 @@
/// the reason for the error.
public static void SetPrivatePropertyValue(object instance, string propertyName, object value)
{
+ if (instance == null)
+ {
+ throw new ArgumentNullException("instance");
+ }
+
var propertyInfo = instance.GetType().GetProperty(propertyName);
if (propertyInfo == null)
{
@@ -223,7 +266,8 @@
/// The expression that resolves to the property to be checked.
/// True if the property is decorated with the given ,
/// false otherwise.
- /// Thrown when
+ /// Thrown when is null .
+ /// Thrown when
/// is not an expression with a property, such as an expression calling multiple methods.
/// Thrown when more then one property is found with
/// name specified in .
Index: Core/Common/test/Core.Common.Base.Test/Geometry/Point2DTest.cs
===================================================================
diff -u -r24da3aa72ccc0776599628c9f971081694048d9a -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/test/Core.Common.Base.Test/Geometry/Point2DTest.cs (.../Point2DTest.cs) (revision 24da3aa72ccc0776599628c9f971081694048d9a)
+++ Core/Common/test/Core.Common.Base.Test/Geometry/Point2DTest.cs (.../Point2DTest.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -156,9 +156,39 @@
}
[Test]
- public void SubstractOperation_TwoDifferentPoints_Return2DVector()
+ public void SubstractOperator_FirstArgumentNull_ThrowArgumentNullException()
{
// Setup
+ Point2D first = null;
+ Point2D second = new Point2D(0,0);
+
+ // Call
+ TestDelegate call = () => { Vector result = first - second; };
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("p1", paramName);
+ }
+
+ [Test]
+ public void SubstractOperator_SecondArgumentNull_ThrowArgumentNullException()
+ {
+ // Setup
+ Point2D first = new Point2D(0, 0);
+ Point2D second = null;
+
+ // Call
+ TestDelegate call = () => { Vector result = first - second; };
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("p2", paramName);
+ }
+
+ [Test]
+ public void SubstractOperator_TwoDifferentPoints_Return2DVector()
+ {
+ // Setup
var point1 = new Point2D(3.0, 4.0);
var point2 = new Point2D(1.0, 1.0);
@@ -172,6 +202,36 @@
}
[Test]
+ public void AddOperator_PointNull_ThrowArgumentNullException()
+ {
+ // Setup
+ Point2D point = null;
+ Vector vector = new DenseVector(2);
+
+ // Call
+ TestDelegate call = () => { Point2D result = point + vector; };
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("point", paramName);
+ }
+
+ [Test]
+ public void AddOperator_VectorNull_ThrowArgumentNullException()
+ {
+ // Setup
+ Point2D point = new Point2D(0, 0);
+ Vector vector = null;
+
+ // Call
+ TestDelegate call = () => { Point2D result = point + vector; };
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("vector", paramName);
+ }
+
+ [Test]
[TestCase(0, 0)]
[TestCase(-6541.2354, 5.25)]
[TestCase(-3.25, -12.55)]
Index: Core/Common/test/Core.Common.Base.Test/Geometry/Segment2DTest.cs
===================================================================
diff -u -r24da3aa72ccc0776599628c9f971081694048d9a -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/test/Core.Common.Base.Test/Geometry/Segment2DTest.cs (.../Segment2DTest.cs) (revision 24da3aa72ccc0776599628c9f971081694048d9a)
+++ Core/Common/test/Core.Common.Base.Test/Geometry/Segment2DTest.cs (.../Segment2DTest.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -283,6 +283,20 @@
}
[Test]
+ public void IsConnected_SegmentNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var segment = new Segment2D(new Point2D(0, 0), new Point2D(1, 1));
+
+ // Call
+ TestDelegate call = () => segment.IsConnected(null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("segment", paramName);
+ }
+
+ [Test]
public void IsConnected_SameSegment_True()
{
// Setup
Index: Core/Common/test/Core.Common.Gui.Test/Plugin/PropertyInfoExtensionsTest.cs
===================================================================
diff -u -r24da3aa72ccc0776599628c9f971081694048d9a -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/test/Core.Common.Gui.Test/Plugin/PropertyInfoExtensionsTest.cs (.../PropertyInfoExtensionsTest.cs) (revision 24da3aa72ccc0776599628c9f971081694048d9a)
+++ Core/Common/test/Core.Common.Gui.Test/Plugin/PropertyInfoExtensionsTest.cs (.../PropertyInfoExtensionsTest.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -19,6 +19,7 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using Core.Common.Gui.Plugin;
using Core.Common.Gui.PropertyBag;
using NUnit.Framework;
@@ -29,6 +30,20 @@
public class PropertyInfoExtensionsTest
{
[Test]
+ public void CreateObjectProperties_InfoNull_ThrowArgumentNullException()
+ {
+ // Setup
+ PropertyInfo info = null;
+
+ // Call
+ TestDelegate call = () => info.CreateObjectProperties(345);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("propertyInfo", paramName);
+ }
+
+ [Test]
public void CreateObjectProperties_SimplePropertyInfo_CreateObjectPropertiesObjectForData()
{
// Setup
Index: Core/Common/test/Core.Common.Gui.Test/PropertyBag/DynamicPropertyBagTest.cs
===================================================================
diff -u -r76c6f433b6291cb6289f3c9e1df08c5491b7869d -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/test/Core.Common.Gui.Test/PropertyBag/DynamicPropertyBagTest.cs (.../DynamicPropertyBagTest.cs) (revision 76c6f433b6291cb6289f3c9e1df08c5491b7869d)
+++ Core/Common/test/Core.Common.Gui.Test/PropertyBag/DynamicPropertyBagTest.cs (.../DynamicPropertyBagTest.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -35,6 +35,17 @@
public class DynamicPropertyBagTest
{
[Test]
+ public void Constructor_PropertyObjectNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new DynamicPropertyBag(null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("propertyObject", paramName);
+ }
+
+ [Test]
public void ParameteredConstructor_ExpectedValues()
{
// Setup
Index: Core/Common/test/Core.Common.Gui.Test/PropertyBag/PropertySpecDescriptorTest.cs
===================================================================
diff -u -r24da3aa72ccc0776599628c9f971081694048d9a -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/test/Core.Common.Gui.Test/PropertyBag/PropertySpecDescriptorTest.cs (.../PropertySpecDescriptorTest.cs) (revision 24da3aa72ccc0776599628c9f971081694048d9a)
+++ Core/Common/test/Core.Common.Gui.Test/PropertyBag/PropertySpecDescriptorTest.cs (.../PropertySpecDescriptorTest.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -31,6 +31,17 @@
public class PropertySpecDescriptorTest
{
[Test]
+ public void Constructor_PropertySpecNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new PropertySpecDescriptor(null, new object());
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("propertySpec", paramName);
+ }
+
+ [Test]
public void ParameteredConstructor_IsPropertyReadOnlyProperty_ExpectedValues()
{
// Setup
Index: Core/Common/test/Core.Common.Gui.Test/PropertyBag/PropertySpecTest.cs
===================================================================
diff -u -rf40da8c67d0dd3f771894c3683a1befa776a8514 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/test/Core.Common.Gui.Test/PropertyBag/PropertySpecTest.cs (.../PropertySpecTest.cs) (revision f40da8c67d0dd3f771894c3683a1befa776a8514)
+++ Core/Common/test/Core.Common.Gui.Test/PropertyBag/PropertySpecTest.cs (.../PropertySpecTest.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -33,6 +33,20 @@
public class PropertySpecTest
{
[Test]
+ public void Constructor_InfoNull_ThrowArgumentNullException()
+ {
+ // Setup
+ PropertyInfo info = null;
+
+ // Call
+ TestDelegate call = () => new PropertySpec(null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("propertyInfo", paramName);
+ }
+
+ [Test]
public void ParameteredConstructor_FromPropertyWithoutAttributesWithPublicGetSet_ExpectedValues()
{
// Setup
Index: Core/Common/test/Core.Common.Utils.Test/Drawing/GraphicsExtensionsTest.cs
===================================================================
diff -u -r24da3aa72ccc0776599628c9f971081694048d9a -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/test/Core.Common.Utils.Test/Drawing/GraphicsExtensionsTest.cs (.../GraphicsExtensionsTest.cs) (revision 24da3aa72ccc0776599628c9f971081694048d9a)
+++ Core/Common/test/Core.Common.Utils.Test/Drawing/GraphicsExtensionsTest.cs (.../GraphicsExtensionsTest.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -19,6 +19,7 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using System.Drawing;
using System.Drawing.Imaging;
using Core.Common.TestUtil;
@@ -32,6 +33,38 @@
public class GraphicsExtensionsTest
{
[Test]
+ public void DrawImageTransparent_GraphicsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ Graphics graphics = null;
+
+ // Call
+ TestDelegate call = () => graphics.DrawImageTransparent(Resources.Black2x2, 1, 1, 0.4f);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("g", paramName);
+ }
+
+ [Test]
+ public void DrawImageTransparent_ImageNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var rect2x2 = new RectangleF(0f, 0f, 2f, 2f);
+ var imageFormat = PixelFormat.Format32bppArgb;
+
+ using (var target = Resources.Black2x2.Clone(rect2x2, imageFormat))
+ {
+ // Call
+ TestDelegate call = () => Graphics.FromImage(target).DrawImageTransparent(null, 0, 0, 0.4f);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("image", paramName);
+ }
+ }
+
+ [Test]
[TestCase(1.0f)]
[TestCase(3.0f)]
public void DrawImageTransparent_DrawWithOpacity1OrGreater_TargetShouldBeIdenticalToSource(float opacity)
Index: Core/Common/test/Core.Common.Utils.Test/Extensions/CollectionExtensionsTest.cs
===================================================================
diff -u -r24da3aa72ccc0776599628c9f971081694048d9a -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/test/Core.Common.Utils.Test/Extensions/CollectionExtensionsTest.cs (.../CollectionExtensionsTest.cs) (revision 24da3aa72ccc0776599628c9f971081694048d9a)
+++ Core/Common/test/Core.Common.Utils.Test/Extensions/CollectionExtensionsTest.cs (.../CollectionExtensionsTest.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -19,6 +19,7 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using System.Collections.Generic;
using Core.Common.Utils.Extensions;
using NUnit.Framework;
@@ -29,6 +30,34 @@
public class CollectionExtensionsTest
{
[Test]
+ public void RemoveAllWhere_CollectionNull_ThrowArgumentNullException()
+ {
+ // Setup
+ ICollection collection = null;
+
+ // Call
+ TestDelegate call = () => collection.RemoveAllWhere(o => true);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("source", paramName);
+ }
+
+ [Test]
+ public void RemoveAllWhere_FilterFunctionNull_ThrowArgumentNullException()
+ {
+ // Setup
+ ICollection collection = new List();
+
+ // Call
+ TestDelegate call = () => collection.RemoveAllWhere(null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("predicate", paramName);
+ }
+
+ [Test]
public void RemoveAllWhere_FilterReturningTrueForAllElements_CollectionIsCleared()
{
// Setup
Index: Core/Common/test/Core.Common.Utils.Test/Extensions/EnumerableExtensionsTest.cs
===================================================================
diff -u -r24da3aa72ccc0776599628c9f971081694048d9a -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/test/Core.Common.Utils.Test/Extensions/EnumerableExtensionsTest.cs (.../EnumerableExtensionsTest.cs) (revision 24da3aa72ccc0776599628c9f971081694048d9a)
+++ Core/Common/test/Core.Common.Utils.Test/Extensions/EnumerableExtensionsTest.cs (.../EnumerableExtensionsTest.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -21,6 +21,7 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using Core.Common.Utils.Extensions;
using NUnit.Framework;
@@ -30,6 +31,34 @@
public class EnumerableExtensionsTest
{
[Test]
+ public void ForEachElementDo_IteratorNull_ThrowArgumentNullException()
+ {
+ // Setup
+ IEnumerable enumerable = null;
+
+ // Call
+ TestDelegate call = () => enumerable.ForEachElementDo(e => e.GetType());
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("source", paramName);
+ }
+
+ [Test]
+ public void ForEachElementDo_ActionNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var enumerable = Enumerable.Empty();
+
+ // Call
+ TestDelegate call = () => enumerable.ForEachElementDo(null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("action", paramName);
+ }
+
+ [Test]
public void ForEachElementDo_PerformTheActionForEachElement()
{
// Setup
Index: Core/Common/test/Core.Common.Utils.Test/IO/EmbeddedResourceFileWriterTest.cs
===================================================================
diff -u -r24da3aa72ccc0776599628c9f971081694048d9a -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/test/Core.Common.Utils.Test/IO/EmbeddedResourceFileWriterTest.cs (.../EmbeddedResourceFileWriterTest.cs) (revision 24da3aa72ccc0776599628c9f971081694048d9a)
+++ Core/Common/test/Core.Common.Utils.Test/IO/EmbeddedResourceFileWriterTest.cs (.../EmbeddedResourceFileWriterTest.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -29,6 +29,28 @@
[TestFixture]
public class EmbeddedResourceFileWriterTest
{
+ [Test]
+ public void Constructor_AssemblyNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new EmbeddedResourceFileWriter(null, true, "A");
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("assembly", paramName);
+ }
+
+ [Test]
+ public void Constructor_FilePathsNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new EmbeddedResourceFileWriter(GetType().Assembly, true, null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("embeddedResourceFileNames", paramName);
+ }
+
[TestCase(true)]
[TestCase(false)]
public void EmbeddedResourceFileWriter_ValidEmbeddedResources_FilesCorrectlyWritten(bool removeFilesOnDispose)
Index: Core/Common/test/Core.Common.Utils.Test/Reflection/AssemblyUtilsTest.cs
===================================================================
diff -u -rb7c2e788d70b36d8fdabb8b7f56e2184df85b550 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/test/Core.Common.Utils.Test/Reflection/AssemblyUtilsTest.cs (.../AssemblyUtilsTest.cs) (revision b7c2e788d70b36d8fdabb8b7f56e2184df85b550)
+++ Core/Common/test/Core.Common.Utils.Test/Reflection/AssemblyUtilsTest.cs (.../AssemblyUtilsTest.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -31,6 +31,17 @@
public class AssemblyUtilsTest
{
[Test]
+ public void GetAssemblyInfo_AssemblyNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => AssemblyUtils.GetAssemblyInfo(null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual(paramName, "assembly");
+ }
+
+ [Test]
public void GetAssemblyInfo()
{
Assembly assembly = Assembly.GetExecutingAssembly();
@@ -107,6 +118,17 @@
}
[Test]
+ public void GetTypeByName_NameNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => AssemblyUtils.GetTypeByName(null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("name", paramName);
+ }
+
+ [Test]
public void GetTypeByName_ForNonexistingClass_ReturnNull()
{
// Call
@@ -117,6 +139,17 @@
}
[Test]
+ public void GetAssemblyResourceStream_AssemblyNull_ThrownArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => AssemblyUtils.GetAssemblyResourceStream(null, "nice.txt");
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("assembly", paramName);
+ }
+
+ [Test]
public void GetAssemblyResourceStream_ForEmbeddedResource_ReturnStream()
{
// Call
Index: Core/Common/test/Core.Common.Utils.Test/Reflection/TypeUtilsTest.cs
===================================================================
diff -u -r7ae9100ff4e61169edcefaeb01b72d492431742f -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Common/test/Core.Common.Utils.Test/Reflection/TypeUtilsTest.cs (.../TypeUtilsTest.cs) (revision 7ae9100ff4e61169edcefaeb01b72d492431742f)
+++ Core/Common/test/Core.Common.Utils.Test/Reflection/TypeUtilsTest.cs (.../TypeUtilsTest.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -21,6 +21,7 @@
using System;
using System.ComponentModel;
+using System.Linq.Expressions;
using System.Reflection;
using Core.Common.Utils.Reflection;
using NUnit.Framework;
@@ -31,6 +32,17 @@
public class TypeUtilsTest
{
[Test]
+ public void Implements_TypeNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => GetType().Implements(null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("type", paramName);
+ }
+
+ [Test]
public void Implements_TypeIsSameClassAsGenericType_ReturnTrue()
{
// Call
@@ -94,6 +106,30 @@
}
[Test]
+ public void GetMemberName_ExpressionNull1_ThrowsArgumentNullException()
+ {
+ // Call
+ Expression> expression = null;
+ TestDelegate call = () => TypeUtils.GetMemberName(expression);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("expression", paramName);
+ }
+
+ [Test]
+ public void GetMemberName_ExpressionNull2_ThrowsArgumentNullException()
+ {
+ // Call
+ Expression> expression = null;
+ TestDelegate call = () => TypeUtils.GetMemberName(expression);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("expression", paramName);
+ }
+
+ [Test]
public void GetMemberName_PropertyExpression_ReturnPropertyName()
{
// Call
@@ -137,6 +173,17 @@
}
[Test]
+ public void GetField_InstanceNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => TypeUtils.GetField(null, "A");
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("instance", paramName);
+ }
+
+ [Test]
public void GetField_PrivateField_ReturnFieldValue()
{
// Setup
@@ -206,6 +253,17 @@
}
[Test]
+ public void SetField_InstanceNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => TypeUtils.SetField(null, "A", "B");
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("obj", paramName);
+ }
+
+ [Test]
public void SetField_SettingPrivateField_FieldHasBeenUpdated()
{
// Setup
@@ -269,6 +327,28 @@
}
[Test]
+ public void CallPrivateMethod_InstanceNull1_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => TypeUtils.CallPrivateMethod(null, "A");
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("instance", paramName);
+ }
+
+ [Test]
+ public void CallPrivateMethod_InstanceNull2_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => TypeUtils.CallPrivateMethod(null, "A");
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("instance", paramName);
+ }
+
+ [Test]
public void CallPrivateMethod_MethodWithReturnValue_ReturnMethodReturnValue()
{
// Setup
@@ -373,6 +453,17 @@
}
[Test]
+ public void SetPrivatePropertyValue_InstanceNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => TypeUtils.SetPrivatePropertyValue(null, "A", "B");
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("instance", paramName);
+ }
+
+ [Test]
public void SetPrivatePropertyValue_PublicPropertyPrivateSetter_PropertyIsSet()
{
// Setup
Index: Core/Components/src/Core.Components.OxyPlot/Converter/ChartDataConverter.cs
===================================================================
diff -u -r49c5da81f49a23dd6e66526d264a08bf510e6963 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Core/Components/src/Core.Components.OxyPlot/Converter/ChartDataConverter.cs (.../ChartDataConverter.cs) (revision 49c5da81f49a23dd6e66526d264a08bf510e6963)
+++ Core/Components/src/Core.Components.OxyPlot/Converter/ChartDataConverter.cs (.../ChartDataConverter.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -60,13 +60,13 @@
/// Transforms a given object into a . Can be used as a
/// .
///
- /// The object to convert into a .
- /// A new based on .
- /// Thrown when is not
- /// of type of .
- protected static DataPoint Point2DToDataPoint(object obj)
+ /// The object to convert into a .
+ /// A new based on .
+ /// Thrown when is not
+ /// of type .
+ protected static DataPoint Point2DToDataPoint(object point2D)
{
- Point2D point = (Point2D) obj;
+ Point2D point = (Point2D) point2D;
return new DataPoint(point.X, point.Y);
}
@@ -75,6 +75,7 @@
///
/// The data to transform into one or more .
/// A new of .
+ /// Thrown when is null .
protected abstract IList Convert(T data);
}
}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs
===================================================================
diff -u -r02d0e67121f748ae6d69ab9f68643d2f5e62f800 -rf08fd5cc1482a6c706bdb04d46b6482d489b7c5b
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 02d0e67121f748ae6d69ab9f68643d2f5e62f800)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision f08fd5cc1482a6c706bdb04d46b6482d489b7c5b)
@@ -460,11 +460,11 @@
///
/// Gets the child data instances that have definitions of some parent data object.
///
- /// The parent data object.
+ /// The parent data object.
/// Sequence of child data.
- public override IEnumerable GetChildDataWithViewDefinitions(object dataObject)
+ public override IEnumerable GetChildDataWithViewDefinitions(object viewData)
{
- var project = dataObject as RingtoetsProject;
+ var project = viewData as RingtoetsProject;
if (project != null)
{
foreach (var item in project.AssessmentSections)
@@ -473,7 +473,7 @@
}
}
- var assessmentSection = dataObject as IAssessmentSection;
+ var assessmentSection = viewData as IAssessmentSection;
if (assessmentSection != null)
{
yield return assessmentSection.FailureMechanismContribution;