public async Task CheckLoggedInUserNotifyPurchase()
        {
            founderUser.IsLoggedIn = true;
            Product p = new Product(new Guid(), 100, 100, 100);

            store.UpdateProduct(p);
            marketStores.LoadedStores.TryAdd(store.Id, store);
            await marketUsers.AddProductToCart(user.Username, p.Id, 5);

            NotificationSubscriber subscriber = PublisherManagement.Instance.FindSubscriber(founder.Username, EventType.PurchaseEvent);
            var pub = PublisherManagement.Instance.FindPublisher(founder.Username);

            pub.LoggedIn = true;
            Assert.AreEqual(0, subscriber.Messages.Count);
            await marketUsers.PurchaseShoppingCart(user.Username, new CreditCard("1", "1", "1", "1", "1", "1"), "054444444", new Address("1", "1", "1", "1", "1"));

            Assert.AreEqual(1, subscriber.Messages.Count);
        }
示例#2
0
        public async Task <Result <bool> > PurchaseShoppingCart
        (
            string username,
            string cardNumber,
            string month,
            string year,
            string holderName,
            string cvv,
            string holderId,
            string phone,
            string state,
            string city,
            string street,
            string apartmentNum,
            string zip
        )
        {
            var card    = new CreditCard(cardNumber, month, year, holderName, cvv, holderId);
            var address = new Address(state, city, street, apartmentNum, zip);

            return(await marketUsers.PurchaseShoppingCart(username, card, phone, address));
        }