Ejemplo n.º 1
0
        public void Create_should_save_auction()
        {
            //using (var scope = new TransactionScope())
            //{
            var connectionString = "Data Source=.;Initial Catalog=EA_AuctionDB;Integrated Security=True";

            var factory = SessionFactoryBuilder.CreateByConnectionString(connectionString, typeof(AuctionMapping).Assembly);
            var session = factory.OpenSession();

            var repository = new AuctionRepository(session, new FakePublisher());
            //var id = repository.GetNextId();
            //var auction = new AuctionBuilder().WithId(id).WithProduct(1).WithSeller(2).Build();
            //auction.PlaceBid(new Bid(1,new Money(auction.StartingPrice.Amount + 10000,"USD")));

            //session.BeginTransaction();
            //repository.Add(auction);
            //session.Transaction.Commit();

            //session.Clear();
            var fetchAuction = repository.GetById(new AuctionId(23));

            //TODO: assert fetch Auction :)
            //}
        }