Example #1
0
        public void SetUp()
        {
            _configuration = Substitute.For <IStarWarsApiConfiguration>();
            _configuration.PageSize.Returns(pageSize);

            _allCharacters = new List <SwCharacter>
            {
                new SwCharacter {
                    Name = "0", Planet = "0"
                },
                new SwCharacter {
                    Name = "1", Planet = "1"
                },
                new SwCharacter {
                    Name = "2", Planet = "2"
                },
                new SwCharacter {
                    Name = "3", Planet = "3"
                },
                new SwCharacter {
                    Name = "4", Planet = "4"
                },
                new SwCharacter {
                    Name = "5", Planet = "5"
                },
            };
            _repository = Substitute.For <ICharacterRepository>();
            _repository.GetQueryable().Returns(_allCharacters.AsQueryable());
            _validator = Substitute.For <IValidateActionsService>();

            _serviceUnderTest = new CharactersService(_configuration, _repository, _validator);
        }
Example #2
0
 public CharactersService(
     IStarWarsApiConfiguration configuration,
     ICharacterRepository repository,
     IValidateActionsService validator)
 {
     _configuration = configuration;
     _repository    = repository;
     _validator     = validator;
 }