public void TestFindAll() { IPerformanceDao dao = DALFactory.CreatePerformanceDao(DALFactory.CreateDatabase()); IList <Performance> entities = dao.findAll(); Assert.AreEqual(entities.Count, 2); }
public void TestFindAll() { ICatagoryDao dao = DALFactory.CreateCatagoryDao(DALFactory.CreateDatabase()); IList <Catagory> entities = dao.findAll(); Assert.AreEqual(entities.Count, 2); }
public void TestFindAll() { IArtistDao dao = DALFactory.CreateArtistDao(DALFactory.CreateDatabase()); IList <Artist> entities = dao.findAll(); Assert.AreEqual(entities.Count, 3); }
public void TestFindById() { ICatagoryDao dao = DALFactory.CreateCatagoryDao(DALFactory.CreateDatabase()); Catagory cat = dao.findById(1); Assert.AreEqual(cat.Id, 1); Assert.AreEqual(cat.Name, "Klassik"); }
public void TestFindById() { IArtistDao dao = DALFactory.CreateArtistDao(DALFactory.CreateDatabase()); Artist artist = dao.findById(1); Assert.AreEqual(artist.Id, 1); Assert.AreEqual(artist.Name, "Larry Page"); }
public void TestFindAll() { IDatabase db = DALFactory.CreateDatabase(); IUserDao dao = DALFactory.CreateUserDao(db); IList <User> entities = dao.findAll(); Assert.AreEqual(entities.Count, 2); }
public void TestFindById() { IPerformanceDao dao = DALFactory.CreatePerformanceDao(DALFactory.CreateDatabase()); Performance performance = dao.findById(1); Assert.AreEqual(performance.Id, 1); Assert.IsFalse(performance.Canceld); }
public void TestFindById() { IDatabase db = DALFactory.CreateDatabase(); IVenueDao dao = DALFactory.CreateVenueDao(db); Venue v = dao.findById(1); Assert.AreEqual(v.Id, 1); Assert.AreEqual(v.Description, "Stage1"); }
public void TestFindById() { IDatabase db = DALFactory.CreateDatabase(); IUserDao dao = DALFactory.CreateUserDao(db); User u = dao.findById(1); Assert.AreEqual(u.Id, 1); Assert.AreEqual(u.Email, "*****@*****.**"); }
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"); }
public void TestFindByUniqueProperty() { IDatabase db = DALFactory.CreateDatabase(); IUserDao dao = DALFactory.CreateUserDao(db); PropertyInfo info = typeof(User).GetProperty("Email"); User u = dao.findByUniqueProperty(info, "*****@*****.**"); Assert.AreEqual(u.Email, "*****@*****.**"); Assert.AreEqual(u.Id, 1); }
public void TestUpdate() { ICatagoryDao dao = DALFactory.CreateCatagoryDao(DALFactory.CreateDatabase()); Catagory cat = dao.findById(1); cat.Name = "Test"; dao.Update(cat); Catagory result = dao.findById(1); Assert.AreEqual(result.Name, cat.Name); }
public void TestUpdate() { IArtistDao dao = DALFactory.CreateArtistDao(DALFactory.CreateDatabase()); Artist artist = dao.findById(1); artist.Email = "*****@*****.**"; dao.Update(artist); Artist result = dao.findById(1); Assert.AreEqual(result.Email, artist.Email); }
public void TestUpdate() { IDatabase db = DALFactory.CreateDatabase(); IUserDao dao = DALFactory.CreateUserDao(db); User u = dao.findById(1); u.FirstName = "Larry"; dao.Update(u); User result = dao.findById(1); Assert.AreEqual(result.FirstName, "Larry"); }
public void TestFindByIdAndCheckFetchCatagory() { IArtistDao dao = DALFactory.CreateArtistDao(DALFactory.CreateDatabase()); Artist artist = dao.findById(1); Assert.AreEqual(artist.Id, 1); Assert.AreEqual(artist.Name, "Larry Page"); ICatagoryDao catDao = DALFactory.CreateCatagoryDao(DALFactory.CreateDatabase()); Catagory cat = catDao.findById(1); Assert.AreEqual(artist.Catagory.Id, cat.Id); }
private static void CreateCatagories() { Console.WriteLine("Insert Catagories "); ICatagoryDao catagoryDao = DALFactory.CreateCatagoryDao(DALFactory.CreateDatabase()); for (int i = 1; i <= 10; i++) { Catagory c = new Catagory(); c.Name = "Catagory " + i; c.Description = "Catagory Description for " + i; catagoryDao.Insert(c); } }
public void TestUpdate() { IDatabase db = DALFactory.CreateDatabase(); IVenueDao dao = DALFactory.CreateVenueDao(db); Venue v = dao.findById(1); v.Description = "TEST-DESCRIPTION"; dao.Update(v); Venue result = dao.findById(1); Assert.AreEqual(result.Description, v.Description); }
static void Main(string[] args) { //string connectionString = ConfigurationManager.ConnectionStrings["PhoneTariffConnectionString"].ConnectionString; //IDatabase database = new Database(connectionString); //ITariffDao tariffDao = new TariffDao(database); IDatabase database = DALFactory.CreateDatabase(); ITariffDao tariffDao = DALFactory.CreateTariffDao(database); var tariff = tariffDao.FindById("A1"); Console.WriteLine(tariff.BasicFee); Console.ReadKey(); }
public void TestInsert() { IDatabase db = DALFactory.CreateDatabase(); IUserDao dao = DALFactory.CreateUserDao(db); User u = new User(); u.Email = "*****@*****.**"; u.FirstName = "Unit Test"; u.LastName = "Unit Test"; u.Password = "******"; dao.Insert(u); PropertyInfo info = typeof(User).GetProperty("Email"); User result = dao.findByUniqueProperty(info, "*****@*****.**"); Assert.AreEqual(result.Email, "*****@*****.**"); }
public void TestInsert() { Catagory cat = new Catagory(); cat.Name = "UNIT-TEST"; cat.Description = "asdf"; ICatagoryDao dao = DALFactory.CreateCatagoryDao(DALFactory.CreateDatabase()); dao.Insert(cat); PropertyInfo info = typeof(Catagory).GetProperty("Name"); Catagory result = dao.findByUniqueProperty(info, "UNIT-TEST"); Assert.AreEqual(result.Name, cat.Name); Assert.AreEqual(result.Description, cat.Description); }
public void TestUpdate() { IPerformanceDao dao = DALFactory.CreatePerformanceDao(DALFactory.CreateDatabase()); Performance performance = dao.findById(1); IArtistDao artistDao = DALFactory.CreateArtistDao(DALFactory.CreateDatabase()); Artist artist = artistDao.findById(2); performance.Artist = artist; performance.StagingTime = DateTime.UtcNow; dao.Update(performance); Performance result = dao.findById(1); //Assert.AreEqual(result.StagingTime, performance.StagingTime); Assert.AreEqual(result.Artist.Id, performance.Artist.Id); }
public void TestInsert() { IDatabase db = DALFactory.CreateDatabase(); IVenueDao dao = DALFactory.CreateVenueDao(db); Venue v = new Venue(); v.Description = "UNIT-TEST"; v.Latitude = 2; v.Longitude = 2; v.ShortDescription = "NO"; v.Address = "TestAddress"; dao.Insert(v); Assert.AreEqual(dao.findAll().Count, 3); }
private static void CreateArtists() { Console.WriteLine("Insert Artists "); Random r = new Random(); RootObject generatedEntries = FetchPersons(); IArtistDao dao = DALFactory.CreateArtistDao(DALFactory.CreateDatabase()); ICatagoryDao catagoryDao = DALFactory.CreateCatagoryDao(DALFactory.CreateDatabase()); generatedEntries.results.ToList().ForEach(x => { Console.WriteLine(x.user.name.first); Artist artist = new Artist(); artist.Catagory = catagoryDao.findById(r.Next(1, 10)); artist.Name = x.user.name.first + " " + x.user.name.last; artist.Email = x.user.email; artist.Country = "AUT"; artist.Picture = GetBase64EncodedImageFromUrl(x.user.picture.thumbnail); dao.Insert(artist); Console.WriteLine("Inserted "); }); }
public void TestInsert() { Performance performance = new Performance(); IArtistDao artistDao = DALFactory.CreateArtistDao(DALFactory.CreateDatabase()); Artist artist = artistDao.findById(1); IVenueDao venueDao = DALFactory.CreateVenueDao(DALFactory.CreateDatabase()); Venue venue = venueDao.findById(1); performance.Artist = artist; performance.Venue = venue; performance.StagingTime = DateTime.Now; IPerformanceDao dao = DALFactory.CreatePerformanceDao(DALFactory.CreateDatabase()); dao.Insert(performance); IList <Performance> result = dao.findAll(); Assert.AreEqual(result.Count, 3); }
private static void CreateVenues() { Console.WriteLine("Insert Venues "); Random rand = new Random(); IVenueDao venueDao = DALFactory.CreateVenueDao(DALFactory.CreateDatabase()); for (int i = 1; i <= 60; i++) { Venue v = new Venue(); v.Address = "My Random Place " + i; v.Description = "This is Random Stage No " + i; v.ShortDescription = "Random Stage " + i; v.Latitude = (int)(48.30613 * 1000000); v.Longitude = (int)(14.286813 * 1000000); v.Latitude = v.Latitude + rand.Next(1, 100); v.Longitude = v.Longitude + rand.Next(1, 100); venueDao.Insert(v); } }
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); }
private static void CreatePerformances() { Console.WriteLine("Insert Performances "); IVenueDao venueDao = DALFactory.CreateVenueDao(DALFactory.CreateDatabase()); IPerformanceDao performanceDao = DALFactory.CreatePerformanceDao(DALFactory.CreateDatabase()); IArtistDao artistDao = DALFactory.CreateArtistDao(DALFactory.CreateDatabase()); int year = 2016; int month = 01; int day = 23; for (int i = 0; i < 3; i++) { int count = 1; int hour = 14; int min = 00; int second = 00; for (int j = 1; j <= 40; j++) { count++; if (count == 10) { hour = hour + 2; count = 1; } DateTime dt = new DateTime(year, month, day, hour, min, second); Venue venue = venueDao.findById(j); Artist artist = artistDao.findById(j); Performance p = new Performance(); p.Artist = artist; p.Venue = venue; p.StagingTime = dt; performanceDao.Insert(p); } day++; } }
public AuthenticationService() { database = DALFactory.CreateDatabase(); }
public AdministrationServices() { database = DALFactory.CreateDatabase(); queryService = ServiceFactory.GetQueryService(); authenticationService = ServiceFactory.GetAuthenticationService(); }
public QueryService() { database = DALFactory.CreateDatabase(); }