public void checkValidRemoveOwnerChain()
        {
            ATSubscriber s1 = new ATSubscriber("owner1");

            publisherManagement.Subscribe("owner1", s1, EventType.RemoveAppointment);
            ATSubscriber s2 = new ATSubscriber("owner2");

            publisherManagement.Subscribe("owner2", s2, EventType.RemoveAppointment);
            ATSubscriber s3 = new ATSubscriber("owner3");

            publisherManagement.Subscribe("owner3", s3, EventType.RemoveAppointment);
            Assert.IsTrue(marketBridge.RemoveOwner("owner1", store.Value, "founder"));
            Assert.AreEqual(s1.EventsReceived.Count, 0);
            Bridge.Logout();
            Bridge.Login(owner1);
            Assert.AreEqual(s1.EventsReceived.Count, 1);
            Assert.AreEqual(s1.EventsReceived.Dequeue().EventProviderName, "RemoveAppointment");
            Assert.AreEqual(s2.EventsReceived.Count, 0);
            Bridge.Logout();
            Bridge.Login(owner2);
            Assert.AreEqual(s2.EventsReceived.Count, 1);
            Assert.AreEqual(s2.EventsReceived.Dequeue().EventProviderName, "RemoveAppointment");
            Assert.AreEqual(s3.EventsReceived.Count, 0);
            Bridge.Logout();
            Bridge.Login(owner3);
            Assert.AreEqual(s3.EventsReceived.Count, 1);
            Assert.AreEqual(s3.EventsReceived.Dequeue().EventProviderName, "RemoveAppointment");
        }
コード例 #2
0
        public async Task CheckValidPurchaseFounderNotified()
        {
            ATSubscriber s = new ATSubscriber("founder");

            publisherManagement.Subscribe("founder", s, EventType.PurchaseEvent);
            marketBridge.AddProductToUserCart(new ProductInCart(pid.Value, 3));
            Assert.IsTrue(await marketBridge.PurchaseShoppingCart(new PurchaseInfo
                                                                  (
                                                                      "0501345677",
                                                                      new CreditCard
                                                                      (
                                                                          cardNumber: "5555000011113333",
                                                                          month: "01",
                                                                          year: "23",
                                                                          holderName: "Forsen",
                                                                          cvv: "999",
                                                                          holderId: "302301007"
                                                                      ),
                                                                      a
                                                                  )));
            Assert.AreEqual(s.EventsReceived.Count, 0);
            Bridge.Logout();
            Bridge.Login(founder);
            Assert.AreEqual(s.EventsReceived.Count, 1);
            Assert.AreEqual(s.EventsReceived.Dequeue().EventProviderName, "PurchaseEvent");
        }
コード例 #3
0
        public void CheckMakeManagerAlreadyAssigned()
        {
            ATSubscriber s = new ATSubscriber("manager");

            publisherManagement.Subscribe("manager", s, EventType.AddAppointmentEvent);
            Assert.IsFalse(marketBridge.MakeManager("manager", store.Value, "founder"));
            Assert.AreEqual(s.EventsReceived.Count, 0);
            Bridge.Logout();
            Bridge.Login(manager2);
            Assert.AreEqual(s.EventsReceived.Count, 0);
        }
        public void checkRemoveOwnerInvalidAssigner()
        {
            ATSubscriber s2 = new ATSubscriber("owner2");

            publisherManagement.Subscribe("owner2", s2, EventType.RemoveAppointment);
            Bridge.Login(founder);
            Assert.IsFalse(marketBridge.RemoveOwner("owner2", store.Value, "founder"));
            Assert.AreEqual(s2.EventsReceived.Count, 0);
            Bridge.Logout();
            Bridge.Login(owner2);
            Assert.AreEqual(s2.EventsReceived.Count, 0);
        }
コード例 #5
0
        public void CheckValidMakeManager()
        {
            ATSubscriber s = new ATSubscriber("manager2");

            publisherManagement.Subscribe("manager2", s, EventType.AddAppointmentEvent);
            Assert.IsTrue(marketBridge.MakeManager("manager2", store.Value, "founder"));
            Assert.AreEqual(s.EventsReceived.Count, 0);
            Bridge.Logout();
            Bridge.Login(manager2);
            Assert.AreEqual(s.EventsReceived.Count, 1);
            Assert.AreEqual(s.EventsReceived.Dequeue().EventProviderName, "AddAppointmentEvent");
        }
        public void checkValidRemoveOwner()
        {
            ATSubscriber s = new ATSubscriber("owner2");

            publisherManagement.Subscribe("owner2", s, EventType.RemoveAppointment);
            Bridge.Login(owner1);
            Assert.IsTrue(marketBridge.RemoveOwner("owner2", store.Value, "owner1"));
            Assert.AreEqual(s.EventsReceived.Count, 0);
            Bridge.Logout();
            Bridge.Login(owner2);
            Assert.AreEqual(s.EventsReceived.Count, 1);
            Assert.AreEqual(s.EventsReceived.Dequeue().EventProviderName, "RemoveAppointment");
        }
コード例 #7
0
        public void CheckMakeOwnerInvalidAssigner()
        {
            ATSubscriber s = new ATSubscriber("owner");

            publisherManagement.Subscribe("owner", s, EventType.AddAppointmentEvent);
            Bridge.Logout();
            Bridge.Login(manager);
            Assert.IsFalse(marketBridge.MakeOwner("owner", store.Value, "manager"));
            Assert.AreEqual(s.EventsReceived.Count, 0);
            Bridge.Logout();
            Bridge.Login(owner1);
            Assert.AreEqual(s.EventsReceived.Count, 0);
        }
コード例 #8
0
        public void checkRemoveManagerBadAppointer()
        {
            ATSubscriber s = new ATSubscriber("manager");

            publisherManagement.Subscribe("manager", s, EventType.RemoveAppointment);
            Bridge.Logout();
            Bridge.Login(owner1);
            Assert.IsFalse(marketBridge.RemoveManager("manager", store.Value, "owner1"));
            Assert.AreEqual(s.EventsReceived.Count, 0);
            Bridge.Logout();
            Bridge.Login(manager);
            Assert.AreEqual(s.EventsReceived.Count, 0);
        }
コード例 #9
0
        public async Task CheckInvalidPurchaseAllOwnerNotNotified()
        {
            ATSubscriber s = new ATSubscriber("founder");

            publisherManagement.Subscribe("founder", s, EventType.PurchaseEvent);
            AppointOwner1();
            ATSubscriber s1 = new ATSubscriber("owner1");

            publisherManagement.Subscribe("owner1", s1, EventType.PurchaseEvent);
            Bridge.Login(buyer1);
            marketBridge.AddProductToUserCart(new ProductInCart(pid.Value, 3));
            Bridge.Logout();
            Bridge.Login(founder);
            p.Quantity = 2;
            marketBridge.EditProductInShop(store.Value, pid.Value, p);
            Bridge.Logout();
            Bridge.Login(buyer1);
            Assert.IsFalse(await marketBridge.PurchaseShoppingCart(new PurchaseInfo
                                                                   (
                                                                       "0501345677",
                                                                       new CreditCard
                                                                       (
                                                                           cardNumber: "5555000011113333",
                                                                           month: "01",
                                                                           year: "23",
                                                                           holderName: "Forsen",
                                                                           cvv: "999",
                                                                           holderId: "302301007"
                                                                       ),
                                                                       a
                                                                   )));
            Assert.AreEqual(s.EventsReceived.Count, 0);
            Bridge.Logout();
            Bridge.Login(founder);
            Assert.AreEqual(s.EventsReceived.Count, 0);
            Assert.AreEqual(s1.EventsReceived.Count, 0);
            Bridge.Logout();
            Bridge.Login(owner1);
            Assert.AreEqual(s1.EventsReceived.Count, 0);
            p.Quantity = 5;
        }