示例#1
0
        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);
        }
示例#2
0
        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);
            }
        }
示例#3
0
        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;
            }
        }