private void FillRepo() { var memberService = new SimpleMemberService(this.MainRepository); var service = new AuctionService(this.MainRepository, memberService); if (service.GetAll().Any()) return; var me = memberService.GetCurrentMember(); service.Save(new Auction { Title = "My asdf Auction", StartDateTimeUtc = DateTime.UtcNow.AddSeconds(10), EndDateTimeUtc = DateTime.UtcNow.AddDays(14), StartPrice = 123, Seller = me, IsRunning = true, IsClosed = false }); service.Save(new Auction { Title = "My Second Auction", StartDateTimeUtc = DateTime.UtcNow.AddSeconds(30), EndDateTimeUtc = DateTime.UtcNow.AddDays(24), StartPrice = 22, Seller = me, IsRunning = false, IsClosed = true }); }
public App() { var ensureDLLIsCopied = SqlProviderServices.Instance; Database.SetInitializer(new MigrateDatabaseToLatestVersion<MainDbContext, Configuration>()); // this.MainRepository = new FileSystemMainRepository("appdata.json"); this.MainRepository = new EFMainRepository(); this.MainRepository.SaveChanges(); var memberService = new SimpleMemberService(this.MainRepository); var service = new AuctionService(this.MainRepository, memberService); // Dummy Data if (!service.GetAll().Any()) { var me = memberService.GetCurrentMember(); service.Save(new Auction { Title = "My First Auction", StartDateTimeUtc = DateTime.UtcNow.AddSeconds(10), EndDateTimeUtc = DateTime.UtcNow.AddDays(14), StartPrice = 72, Seller = me }); } this.AuctionRunner = new AuctionRunner(this.MainRepository); this.AuctionRunner.Start(); }
public static void Main() { Console.WriteLine("DotNetBay Commandline"); AuctionRunner auctionRunner = null; try { var store = new FileSystemMainRepository("store.json"); var auctionService = new AuctionService(store, new SimpleMemberService(store)); auctionRunner = new AuctionRunner(store); Console.WriteLine("Started AuctionRunner"); auctionRunner.Start(); var allAuctions = auctionService.GetAll(); Console.WriteLine("Found {0} auctions returned by the service.", allAuctions.Count()); Console.Write("Press enter to quit"); Console.ReadLine(); } finally { if (auctionRunner != null) { auctionRunner.Dispose(); } } Environment.Exit(0); }
public MainWindow() { if ((Application.Current as App) != null) { var service = new AuctionService(((App)Application.Current).MainRepository, new SimpleMemberService(((App)Application.Current).MainRepository)); foreach (var auction in service.GetAll()) { this.Auctions.Add(auction); } } this.DataContext = this; this.InitializeComponent(); }
public void GivenAProperService_SavesAValidAuction_ShouldReturnSameFromAuctionList() { var repo = new InMemoryMainRepository(); var userService = new SimpleMemberService(repo); var service = new AuctionService(repo, userService); var auction = CreateGeneratedAuction(); auction.Seller = userService.Add("Seller", "*****@*****.**"); service.Save(auction); var auctionFromService = service.GetAll().First(); Assert.AreEqual(auctionFromService, auction); }
public static void Main(string[] args) { var ensureDLLIsCopied = System.Data.Entity.SqlServer.SqlProviderServices.Instance; Console.WriteLine("DotNetBay Commandline"); var store = new FileSystemMainRepository("store.json"); var auctionService = new AuctionService(store, new SimpleMemberService(store)); var auctionRunner = new AuctionRunner(store); Console.WriteLine("Started AuctionRunner"); auctionRunner.Start(); var allAuctions = auctionService.GetAll(); Console.WriteLine("Found {0} auctions returned by the service.", allAuctions.Count()); Console.Write("Press enter to quit"); Console.ReadLine(); Environment.Exit(0); }