public void TestAddPhone() { IUnityContainer container = GenericSingleton <ComponentContainer> .GetInstance().Container; IDomainFactory factory = container.Resolve <PhoneFactory>(); Phone ph = (Phone)factory.CreateBusinessEntity(); ph.phoneNumber = "6125551234"; ph.AddToDb(); Phone phNew = (Phone)factory.GetBusinessEntityById(ph.phoneId); Assert.AreEqual(phNew.BusinessEntityID, ph.BusinessEntityID); }
public void TestDeleteBeforeInDB() { IUnityContainer container = GenericSingleton <ComponentContainer> .GetInstance().Container; IDomainFactory factory = container.Resolve <PhoneFactory>(); Phone ph = (Phone)factory.CreateBusinessEntity(); ph.phoneNumber = "6515551234"; try { ph.Delete(); } catch (InvalidOperationException ex) { Assert.IsTrue(true, ex.Message); } }
public void TestUpdateBeforeInDB() { IUnityContainer container = GenericSingleton <ComponentContainer> .GetInstance().Container; IDomainFactory factory = container.Resolve <PhoneFactory>(); Phone ph = (Phone)factory.CreateBusinessEntity(); ph.phoneNumber = "6515551234"; Exception genEx; try { ph.Update(); } catch (InvalidOperationException ex) { genEx = ex; } }