1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.Applications
.MindDump
.Tests
18 using System
.Collections
;
20 using Castle
.Applications
.MindDump
.Dao
;
21 using Castle
.Applications
.MindDump
.Model
;
23 using NUnit
.Framework
;
27 public class BlogTestCase
: BaseMindDumpTestCase
34 AuthorDao authorDao
= (AuthorDao
) Container
[ typeof(AuthorDao
) ];
35 BlogDao blogDao
= (BlogDao
) Container
[ typeof(BlogDao
) ];
37 Author author
= new Author("hamilton verissimo", "hammett", "mypass");
38 Blog blog
= new Blog("hammett's blog", "my thoughts.. ugh!", "default", author
);
40 authorDao
.Create( author
);
41 blogDao
.Create( blog
);
43 IList blogs
= blogDao
.Find();
44 Assert
.AreEqual( 1, blogs
.Count
);
46 Blog comparisson
= (Blog
) blogs
[0];
47 Assert
.AreEqual( blog
.Name
, comparisson
.Name
);
48 Assert
.AreEqual( blog
.Description
, comparisson
.Description
);
49 Assert
.AreEqual( blog
.Theme
, comparisson
.Theme
);
57 AuthorDao authorDao
= (AuthorDao
) Container
[ typeof(AuthorDao
) ];
58 BlogDao blogDao
= (BlogDao
) Container
[ typeof(BlogDao
) ];
60 Author author
= new Author("hamilton verissimo", "hammett", "mypass");
61 Blog blog1
= new Blog("hammett's blog", "my thoughts.. ugh!", "default", author
);
62 Blog blog2
= new Blog("hammett's personal blog", "more thoughts.. ugh!", "default", author
);
64 authorDao
.Create( author
);
65 blogDao
.Create( blog1
);
66 blogDao
.Create( blog2
);
68 IList blogs
= blogDao
.Find();
69 Assert
.AreEqual( 2, blogs
.Count
);