Пример #1
0
        public void PropertiesRequiredValid()
        {
            var manufacturer = EntitiesFactory.GetNewManufacturer();

            bool result = manufacturer.ValidatePropertiesRequired();

            result.Should().BeTrue();
        }
        public async void GetByIdValid()
        {
            var manufacturer = EntitiesFactory.GetNewManufacturer();

            _manufacturedRepository.GetById(manufacturer.Id).Returns(manufacturer);

            Manufacturer result = await _manufacturerService.GetById(manufacturer.Id);

            result.Should().NotBeNull();
        }
        public async void SaveValid()
        {
            var manufactured = EntitiesFactory.GetNewManufacturer();

            _manufacturedRepository.Save(manufactured).Returns(true);

            bool result = await _manufacturerService.Save(manufactured);

            result.Should().BeTrue();
        }
        public async void GetByIdInvalid(string id)
        {
            var manufacturer = EntitiesFactory.GetNewManufacturer();

            _manufacturedRepository.GetById(id).Returns(manufacturer);

            var result = await _manufacturerService.GetById(id);

            result.Should().BeNull();
        }
        public async void RemoveInvalid(string id)
        {
            var manufacturer = EntitiesFactory.GetNewManufacturer();

            manufacturer.Id = id;
            _manufacturedRepository.Save(manufacturer).Returns(true);

            bool result = await _manufacturerService.Remove(manufacturer);

            result.Should().BeFalse();
        }
        public async void GetAllValid()
        {
            var listReturns = new List <Manufacturer> {
                EntitiesFactory.GetNewManufacturer()
            };

            _manufacturedRepository.GetAll().Returns(listReturns);

            IEnumerable <Manufacturer> result = await _manufacturerService.GetAll();

            result.Should().NotBeNull();
        }
        public async void ImportValid()
        {
            var manufactured      = EntitiesFactory.GetNewManufacturer();
            var listManufacturers = new List <Manufacturer> {
                manufactured
            };

            _manufacturedRepository.Import(listManufacturers).Returns(true);

            bool result = await _manufacturerService.Import(listManufacturers);

            result.Should().BeTrue();
        }
        public async void GetByCompanyIdValid()
        {
            var manufactured = EntitiesFactory.GetNewManufacturer();
            var listReturns  = new List <Manufacturer> {
                manufactured
            };

            _manufacturedRepository.GetByCompanyId(manufactured.CompanyId).Returns(listReturns);

            IEnumerable <Manufacturer> result = await _manufacturerService.GetByCompanyId(manufactured.CompanyId);

            result.Should().NotBeNull();
        }