Пример #1
0
        public void GetAll_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository = new PhoneTypeRepository(context);

            // Act
            IEnumerable <phoneType> result = repository.GetAll();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(context.phoneType.Count(), result.Count());
        }
Пример #2
0
        public ContactManager(AddressRepository addressRepository,
                              AddressTypeRepository addressTypeRepository,
                              PhoneRepository phoneRepository,
                              PhoneTypeRepository phoneTypeRepository,
                              ProfileAddressRepository profileAddressRepository,
                              ProfilePhoneRepository profilePhoneRepository,
                              ProfileRepository profileRepository)
        {
            if (addressRepository == null)
            {
                throw new ArgumentNullException("addressRepository");
            }

            if (addressTypeRepository == null)
            {
                throw new ArgumentNullException("addressTypeRepository");
            }

            if (phoneRepository == null)
            {
                throw new ArgumentNullException("phoneRepository");
            }

            if (phoneTypeRepository == null)
            {
                throw new ArgumentNullException("phoneTypeRepository");
            }

            if (profileAddressRepository == null)
            {
                throw new ArgumentNullException("profileAddressRepository");
            }

            if (profilePhoneRepository == null)
            {
                throw new ArgumentNullException("profilePhoneRepository");
            }

            if (profileRepository == null)
            {
                throw new ArgumentNullException("profileRepository");
            }

            _addressRepository        = addressRepository;
            _addressTypeRepository    = addressTypeRepository;
            _phoneRepository          = phoneRepository;
            _phoneTypeRepository      = phoneTypeRepository;
            _profileAddressRepository = profileAddressRepository;
            _profilePhoneRepository   = profilePhoneRepository;
            _profileRepository        = profileRepository;
        }
Пример #3
0
        public void GetById_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository = new PhoneTypeRepository(context);
            int id         = 1;

            // Act
            phoneType result = repository.GetById(id);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(id, result.id);
        }
Пример #4
0
        public void GetById_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository = new PhoneTypeRepository(context);
            var service    = new PhoneTypeService(repository);
            int id         = 1;

            // Act
            PhoneTypeModel result = service.GetById(id);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(id, result.Id);
        }
Пример #5
0
        public ContactManager(AddressRepository addressRepository,
                              AddressTypeRepository addressTypeRepository,
                              PhoneRepository phoneRepository,
                              PhoneTypeRepository phoneTypeRepository,
                              ProfileAddressRepository profileAddressRepository,
                              ProfilePhoneRepository profilePhoneRepository,
                              ProfileRepository profileRepository)
        {
            if (addressRepository == null)
                throw new ArgumentNullException("addressRepository");

            if (addressTypeRepository == null)
                throw new ArgumentNullException("addressTypeRepository");

            if (phoneRepository == null)
                throw new ArgumentNullException("phoneRepository");

            if (phoneTypeRepository == null)
                throw new ArgumentNullException("phoneTypeRepository");

            if (profileAddressRepository == null)
                throw new ArgumentNullException("profileAddressRepository");

            if (profilePhoneRepository == null)
                throw new ArgumentNullException("profilePhoneRepository");

            if (profileRepository == null)
                throw new ArgumentNullException("profileRepository");

            _addressRepository = addressRepository;
            _addressTypeRepository = addressTypeRepository;
            _phoneRepository = phoneRepository;
            _phoneTypeRepository = phoneTypeRepository;
            _profileAddressRepository = profileAddressRepository;
            _profilePhoneRepository = profilePhoneRepository;
            _profileRepository = profileRepository;
        }
 public void Setup()
 {
     _ctx.Database.Delete();
     _repository = new PhoneTypeRepository(_ctx);
 }