示例#1
0
        public void TestFindByUniqueProperty()
        {
            IArtistDao   dao    = DALFactory.CreateArtistDao(DALFactory.CreateDatabase());
            PropertyInfo info   = typeof(Artist).GetProperty("Email");
            Artist       artist = dao.findByUniqueProperty(info, "*****@*****.**");

            Assert.AreEqual(artist.Id, 1);
            Assert.AreEqual(artist.Email, "*****@*****.**");
            Assert.AreEqual(artist.Name, "Larry Page");
        }
示例#2
0
        public void TestInsert()
        {
            PropertyInfo info   = typeof(Artist).GetProperty("Email");
            Artist       artist = new Artist();

            artist.Email   = "*****@*****.**";
            artist.Name    = "UnitTestArtist";
            artist.Link    = "I do not have any Link";
            artist.Country = "AUT";

            IArtistDao dao = DALFactory.CreateArtistDao(DALFactory.CreateDatabase());

            dao.Insert(artist);

            Artist result = dao.findByUniqueProperty(info, "*****@*****.**");

            Assert.AreEqual(result.Email, artist.Email);
            Assert.AreEqual(result.Name, artist.Name);
            Assert.AreEqual(result.Link, artist.Link);
            Assert.AreEqual(result.Country, artist.Country);
        }
示例#3
0
        public Artist QueryArtistById(string id)
        {
            IArtistDao dao = DALFactory.CreateArtistDao(database);

            return(dao.findByUniqueProperty(typeof(Artist).GetProperty("Email"), id));
        }