Example #1
0
        public void TestGetAddressById()
        {
            //IDomainFactory factory = this.container.Resolve<IDomainFactory>("AddressFactory");
            var repo = new GenericRepository <AddressDto>();

            IDomainFactory factory = new AddressFactory(repo);

            string test = string.Format("{0} Main St", DateTime.Now.Second);

            Address address = (Address)factory.CreateDomainObject(1);

            address.addressLine1 = test;

            address.Persist();

            Assert.IsNotNull(address.addressLine1, test);
        }
Example #2
0
        // GET api/employees
        public Address Get()
        {
            this.container = new UnityContainer();
            this.container.RegisterType <DbContext, HFBDataContext>("HFB");
            this.container.RegisterType(typeof(IRepository <>), typeof(GenericRepository <>));
            this.container.RegisterType <IDomainObject, Address>("Address");
            this.container.RegisterType <IDomainFactory, AddressFactory>("AddressFactory");

            var repo = new GenericRepository <AddressDto>();

            IDomainFactory factory = new AddressFactory(repo);

            string test = string.Format("{0} Main St", DateTime.Now.Second);

            Address address = (Address)factory.CreateDomainObject(1);

            address.addressLine1 = test;

            return(address);
            //return list;
        }