Пример #1
0
 public void CreateCustomer_CheckAllowSetAsCurrent()
 {
     using (CustomersList list = (CustomersList)ModulesManager.Current.OpenModuleObjectDetail(new CustomersListObject(Session), false)) {
         using (CustomerDetail detail = (CustomerDetail)list.OpenDetail(null, null)) {
             detail.CustomerEdit.VRObjectEditObject.VideoRentObject.FirstName = "x";
             detail.CustomerEdit.VRObjectEditObject.VideoRentObject.LastName  = "y";
             Assert.IsFalse(detail.AllowSetAsCurrentCustomer);
             Assert.IsFalse(detail.SetAsCurrentCustomer());
             Assert.IsTrue(detail.Save());
             Assert.IsTrue(detail.AllowSetAsCurrentCustomer);
             Assert.IsTrue(detail.SetAsCurrentCustomer());
         }
     }
 }
Пример #2
0
 public void CreateCustomer_SetAsCurrent_Delete_OpenCurrentCustomerDetail()
 {
     using (CustomersList list = (CustomersList)ModulesManager.Current.OpenModuleObjectDetail(new CustomersListObject(Session), false)) {
         using (CustomerDetail detail = (CustomerDetail)list.OpenDetail(null, null)) {
             detail.CustomerEdit.VRObjectEditObject.VideoRentObject.FirstName = "x";
             detail.CustomerEdit.VRObjectEditObject.VideoRentObject.LastName  = "y";
             Assert.IsTrue(detail.Save());
             Assert.IsTrue(detail.SetAsCurrentCustomer());
             Assert.IsTrue(detail.Close());
         }
         Assert.IsNotNull(CurrentCustomerProvider.Current.CurrentCustomer);
         Customer currentCustomer = SessionHelper.GetObject <Customer>(CurrentCustomerProvider.Current.CurrentCustomer, list.CustomersEdit.VRObjectsEditObject.VideoRentObjects.Session);
         Assert.AreEqual("x", currentCustomer.FirstName);
         Assert.AreEqual("y", currentCustomer.LastName);
         list.CustomersEdit.CurrentRecord = currentCustomer;
         Assert.IsTrue(list.CustomersEdit.DeleteCurrentRecord());
         Assert.IsNull(CurrentCustomerProvider.Current.CurrentCustomerOid);
     }
 }