示例#1
0
        public void SearchEmailInPerson()
        {
            var user     = DataMother.CreateSupplierUser();
            var supplier = (Supplier)user.RootService;

            var email        = "*****@*****.**";
            var contactGroup = new ContactGroup {
                Type              = ContactGroupType.General,
                Specialized       = true,
                Name              = email,
                ContactGroupOwner = supplier.ContactGroupOwner
            };

            session.Save(contactGroup);
            contactGroup.AddPerson("testPerson");
            contactGroup.Persons.Last().AddContact(ContactType.Email, email);
            user.ContactGroup = contactGroup;
            session.SaveOrUpdate(user);
            Flush();
            filter.SearchBy   = SearchUserBy.ByContacts;
            filter.SearchText = email;
            var result = filter.Find();

            Assert.That(result.Count, Is.EqualTo(1));
            Assert.That(result[0].ClientId, Is.EqualTo(supplier.Id));
        }
 public void SetUp()
 {
     user     = DataMother.CreateSupplierUser();
     supplier = (Supplier)user.RootService;
     payer    = DataMother.CreatePayer();
     session.Save(payer);
 }
        public void NoChangeOrderRegionIfSupplierTest()
        {
            var user = DataMother.CreateSupplierUser();

            user.Name            = "Тестовый пользователь для редактирования";
            user.OrderRegionMask = 16;
            session.Save(user);
            var oldMask = user.OrderRegionMask;

            controller.Update(user,
                              new[] {
                new Contact {
                    ContactText = "123"
                }
            },
                              new[] {
                new Contact {
                    ContactText = "1231"
                }
            },
                              new[] {
                new Person {
                    Name = "321"
                }
            },
                              new[] {
                new Person {
                    Name = "4321"
                }
            });
            Assert.That(user.OrderRegionMask, Is.EqualTo(oldMask));
        }
示例#4
0
        public void Test_search_payer_contact()
        {
            var user     = DataMother.CreateSupplierUser();
            var supplier = (Supplier)user.RootService;

            session.Save(supplier.Payer);
            Flush();
            session.Flush();

            var tempEmail = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 10);

            session.CreateSQLQuery(string.Format(@"
insert into contacts.contacts (contacttext, contactOwnerId) value ('{0}', {2});

set @setId = last_insert_id();

insert into contacts.payerownercontacts (contact, payer) value (@setId, {1});",
                                                 tempEmail + "@test.ru", supplier.Payer.Id, supplier.Payer.ContactGroupOwner.ContactGroups.First().Id)).ExecuteUpdate();
            Flush();
            filter.SearchBy   = SearchUserBy.ByContacts;
            filter.SearchText = tempEmail;
            var result = filter.Find();

            Assert.That(result.Count, Is.EqualTo(1), tempEmail);
            Assert.That(result[0].ClientId, Is.EqualTo(supplier.Id));
        }
示例#5
0
 public void Setup()
 {
     user = DataMother.CreateSupplierUser();
     Flush();
     payer      = user.Payer;
     controller = new AccountsController();
     Prepare(controller);
 }
        public void Show_supplier_client()
        {
            var user = DataMother.CreateSupplierUser();

            Flush();

            controller.Edit(user.Id, new MessageQuery());
        }
        public void Show_accounting_history_for_supplier_user()
        {
            var user = DataMother.CreateSupplierUser();

            user.Accounting.Accounted();
            Open("Accounts/Index?tab=AccountingHistory");
            browser.WaitUntilContainsText("Поиск", 2);
            AssertText("Поиск");
            AssertText(user.Login);
        }
示例#8
0
        public void Show_update_reject_for_supplier_user()
        {
            var user = DataMother.CreateSupplierUser();

            updateLog = new UpdateLogEntity(user)
            {
                UpdateType = UpdateType.AccessError,
            };
            Save(updateLog);
            Open("Logs/UpdateLog?regionMask={0}&updateType={1}", 18446744073709551615ul, UpdateType.AccessError);
            AssertText(user.Login);
        }
示例#9
0
        public void Ignore_user_check_on_supplier_delete()
        {
            var user     = DataMother.CreateSupplierUser();
            var supplier = (Supplier)user.RootService;

            supplier.Disabled = true;
            Save(supplier);
            Assert.That(supplier.CanDelete(session), Is.True);
            supplier.Delete(session);
            session.Flush();

            Reopen();
            Assert.That(session.Get <Supplier>(supplier.Id), Is.Null);
        }
示例#10
0
        public void Search_email_in_user()
        {
            var user     = DataMother.CreateSupplierUser();
            var supplier = (Supplier)user.RootService;

            var email        = @"*****@*****.**";
            var contactGroup = new ContactGroup {
                Type              = ContactGroupType.General,
                Specialized       = true,
                Name              = "testGroup",
                ContactGroupOwner = supplier.ContactGroupOwner
            };

            session.Save(contactGroup);
            user.ContactGroup = contactGroup;
            user.ContactGroup.AddContact(ContactType.Email, email);
            session.SaveOrUpdate(user);

            var user2 = new User(supplier.Payer, supplier);

            user2.Setup(session);
            session.SaveOrUpdate(user2);

            Flush();
            filter.SearchBy   = SearchUserBy.ByContacts;
            filter.SearchText = email;
            var result = filter.Find();

            Assert.That(result.Count, Is.EqualTo(1));
            Assert.That(result[0].ClientId, Is.EqualTo(supplier.Id));

            var email2 = "*****@*****.**";

            supplier.ContactGroupOwner.ContactGroups[0].AddContact(ContactType.Email, email2);
            Save(supplier);

            Flush();

            filter.SearchText = email2;
            result            = filter.Find();
            Assert.That(result.Count, Is.EqualTo(2));

            session.Delete(user);
            session.Delete(user2);
            Flush();
        }
示例#11
0
        public void Search_by_supplier_contact_phone()
        {
            var user     = DataMother.CreateSupplierUser();
            var supplier = (Supplier)user.RootService;

            var phone = RandomPhone();

            supplier.ContactGroupOwner.ContactGroups[0].AddContact(ContactType.Phone, phone);
            Save(supplier);
            Flush();

            filter.SearchText = phone;
            var result = filter.Find();

            Assert.That(result.Count, Is.EqualTo(1));
            Assert.That(result[0].ClientId, Is.EqualTo(supplier.Id));
        }
示例#12
0
        public void Do_not_search_contacts_in_disabled_order_delivery_groups()
        {
            var user     = DataMother.CreateSupplierUser();
            var supplier = (Supplier)user.RootService;

            var phone      = RandomPhone();
            var orderGroup = new RegionalDeliveryGroup(session.Load <Region>(2ul));

            orderGroup.AddContact(ContactType.Phone, phone);
            supplier.ContactGroupOwner.AddContactGroup(orderGroup, true);
            Save(supplier);
            Flush();

            filter.SearchText = phone;
            var result = filter.Find();

            Assert.That(result.Count, Is.EqualTo(0), result.Implode(r => r.ClientId));
        }
        public void Disable_supplier()
        {
            var user     = DataMother.CreateSupplierUser();
            var supplier = (Supplier)user.RootService;

            Save(supplier);

            Open(supplier.Payer);
            AssertText("Плательщик");
            browser.CheckBox(Find.ByName("status")).Click();
            browser.TextField(Find.ByName("AddComment")).AppendText("TestComment");
            ConfirmDialog();

            Wait(() => {
                session.Refresh(supplier);
                return(supplier.Disabled);
            }, String.Format("Нe удалось дождаться отключения поставщика {0}", browser.Url));
            Assert.That(supplier.Disabled, Is.True, browser.Url);
        }
示例#14
0
 public void Setup()
 {
     user     = DataMother.CreateSupplierUser();
     supplier = (Supplier)user.RootService;
 }