Пример #1
0
        public void TestGetPhoneById()
        {
            int entityId = phoneTestId;

            IUnityContainer container = GenericSingleton <ComponentContainer> .GetInstance().Container;

            IDomainFactory factory = container.Resolve <PhoneFactory>();

            Phone ph = (Phone)factory.GetBusinessEntityById(entityId);

            Assert.AreEqual(entityId, ph.BusinessEntityID);
        }
Пример #2
0
        public void TestGetCustomerById()
        {
            int entityId = custTestId;

            IUnityContainer container = GenericSingleton <ComponentContainer> .GetInstance().Container;

            IDomainFactory factory = container.Resolve <CustomerFactory>();

            IDomainObject c = factory.GetBusinessEntityById(entityId);

            Assert.AreEqual(entityId, c.BusinessEntityID);
        }
Пример #3
0
        public void TestDeletePhone()
        {
            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);

            phNew.Delete();

            Phone phNull = (Phone)factory.GetBusinessEntityById(phNew.phoneId);

            Assert.IsNull(phNull);
        }