~ubuntu-branches/ubuntu/trusty/smuxi/trusty-proposed

« back to all changes in this revision

Viewing changes to lib/ServiceStack/src/ServiceStack.Common/Utils/AssertUtils.cs

  • Committer: Package Import Robot
  • Author(s): Mirco Bauer
  • Date: 2013-05-25 22:11:31 UTC
  • mfrom: (1.2.12)
  • Revision ID: package-import@ubuntu.com-20130525221131-nd2mc0kzubuwyx20
Tags: 0.8.11-1
* [22d13d5] Imported Upstream version 0.8.11
* [6d2b95a] Refreshed patches
* [89eb66e] Added ServiceStack libraries to smuxi-engine package
* [848ab10] Enable Campfire engine
* [c6dbdc7] Always build db4o for predictable build result
* [13ec489] Exclude OS X specific libraries from dh_clideps

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
using System;
 
2
using System.Collections.Generic;
 
3
 
 
4
namespace ServiceStack.Common.Utils
 
5
{
 
6
    public static class AssertUtils
 
7
    {
 
8
        public static void AreNotNull<T>(params T[] fields) where T : class 
 
9
        {
 
10
            foreach (var field in fields)
 
11
            {
 
12
                if (field == null)
 
13
                {
 
14
                    throw new ArgumentNullException(typeof(T).Name);
 
15
                }
 
16
            }
 
17
        }
 
18
 
 
19
        /// <summary>
 
20
        /// Asserts that the supplied arguments are not null.
 
21
        /// 
 
22
        /// AssertUtils.AreNotNull(new Dictionary<string,object>{ {"name",null} });
 
23
        ///   will throw new ArgumentNullException("name");
 
24
        /// </summary>
 
25
        /// <param name="fieldMap">The field map.</param>
 
26
        public static void AreNotNull(IDictionary<string,object> fieldMap)
 
27
        {
 
28
            foreach (var pair in fieldMap)
 
29
            {
 
30
                if (pair.Value == null)
 
31
                {
 
32
                    throw new ArgumentNullException(pair.Key);
 
33
                }
 
34
            }
 
35
        }
 
36
    }
 
37
}
 
 
b'\\ No newline at end of file'