[tasque] Fix initial assignment of task list name



commit 04709fb6402512feec9e9c1c119e86e174e5a559
Author: Antonius Riha <antoniusriha gmail com>
Date:   Mon Mar 18 11:37:19 2013 +0100

    Fix initial assignment of task list name

 src/libtasque/Core/Impl/TaskList.cs |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/libtasque/Core/Impl/TaskList.cs b/src/libtasque/Core/Impl/TaskList.cs
index cad7328..a982663 100644
--- a/src/libtasque/Core/Impl/TaskList.cs
+++ b/src/libtasque/Core/Impl/TaskList.cs
@@ -64,8 +64,7 @@ namespace Tasque.Core.Impl
                        this.noteRepo = noteRepo;
 
                        isBackendDetached = true;
-
-                       Name = name;
+                       InitName (name);
                }
 
                public TaskList (string name, ITaskListRepository taskListRepo,
@@ -77,7 +76,7 @@ namespace Tasque.Core.Impl
                {
                        isBackendDetached = true;
                        ListType = TaskListType.Smart;
-                       Name = name;
+                       InitName (name);
                }
 
                public int Count { get { return Tasks.Count; } }
@@ -252,6 +251,16 @@ namespace Tasque.Core.Impl
                                return tasks ?? (tasks = new TaskListTaskCollection (this));
                        }
                }
+               
+               void InitName (string name)
+               {
+                       if (name == null)
+                               throw new ArgumentNullException ("name");
+                       if (string.IsNullOrWhiteSpace (name))
+                               throw new ArgumentException (
+                                       "Must not be empty or white space", "name");
+                       this.name = name;
+               }
 
                void ThrowIfIsReadOnly ()
                {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]