public void Test09WhenAClientHasPurchasesThenHisPurchasesIsNotEmpty() { IYourBooksApplication application = objectProvider.YourBooksApplication(); application.RegisterClient("marcos", "123"); Client aClient = application.Login("marcos", "123"); //TODO: revisar si no queremos seguir desacoplando los ID de la base de datos. Guid aCartId = application.CreateCart(aClient.Id, aClient.Password); application.AddAQuantityOfAnItem(1, objectProvider.ABook(), aCartId); application.CheckoutCart(aCartId, objectProvider.AValidCreditCard(), objectProvider.ACatalog()); Assert.IsTrue(application.PurchasesFor(aClient).Item2 != 0);//TODO; ver esta monstruosidad. Asertar lo que corresponda. }
public void Test10WhenAClientBuyABookHisPurchasesHasRegisteredThatSale() { IYourBooksApplication application = objectProvider.YourBooksApplication(); application.RegisterClient("marcos", "123"); Client aClient = application.Login("marcos", "123"); Guid aCartId = application.CreateCart(aClient.Id, aClient.Password); application.AddAQuantityOfAnItem(1, objectProvider.ABook(), aCartId); Guid transactionId = application.CheckoutCart(aCartId, objectProvider.AValidCreditCard(), objectProvider.ACatalog()); Sale aSale = application.GetSale(transactionId); Assert.IsTrue(application.PurchasesContainsASaleForAClient(aSale, aClient)); }
public void Test06CanCheckoutACartWithOneBookWithASpecificCatalog() { IYourBooksApplication application = objectProvider.YourBooksApplication(); application.RegisterClient("marcos", "123"); Client aClient = application.Login("marcos", "123"); Guid aCartId = application.CreateCart(aClient.Id, aClient.Password); application.AddAQuantityOfAnItem(1, objectProvider.ABook(), aCartId); Guid transactionId = application.CheckoutCart(aCartId, objectProvider.AValidCreditCard(), objectProvider.ACatalog()); Sale sale = application.GetSale(transactionId); Assert.IsTrue(application.IsSaleRegistered(sale)); }
public void Test07CanNotCheckoutACartWithAnInvalidBookWithASpecificCatalog() { IYourBooksApplication application = objectProvider.YourBooksApplication(); application.RegisterClient("marcos", "123"); Client aClient = application.Login("marcos", "123"); Guid aCartId = application.CreateCart(aClient.Id, aClient.Password); application.AddAQuantityOfAnItem(1, objectProvider.AnInvalidBook(), aCartId); try { application.CheckoutCart(aCartId, objectProvider.AValidCreditCard(), objectProvider.ACatalog()); Assert.Fail(); } catch (ArgumentException e) { Assert.AreEqual("The cart has invalid books!", e.Message); } }