예제 #1
0
        public async void ValidateGetCharacterByIdAsync()
        {
            string paramHash = "ts=1&apikey=cdb7af1ef4a3c260a36fc5c2ee256748&hash=55a92ac6bc5a277824869d02a9c5ab53";

            Characters character = new Characters()
            {
                Avatar      = "http://i.annihil.us/u/prod/marvel/i/mg/c/e0/535fecbbb9784.png",
                Id          = 1011334,
                Name        = "3-D Man",
                Description = null
            };

            CharactersService verif = new CharactersService();

            dynamic result = JsonConvert.DeserializeObject(await verif.GetCharacterById(character.Id, paramHash));

            Characters details = new Characters()
            {
                Id          = result.data.results[0].id,
                Name        = result.data.results[0].name,
                Avatar      = result.data.results[0].thumbnail.path + "." + result.data.results[0].thumbnail.extension,
                Description = result.data.results[0].description == "" ? null : result.data.results[0].description
            };

            Assert.Equal(character.Id, details.Id);
        }
예제 #2
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);
        }
예제 #3
0
    private void Start()
    {
        _currentDocuments    = new List <GameObject>();
        _characterGameObject = Instantiate(_characterPrefab);
        _characterAnimation  = _characterGameObject.GetComponent <Animation>();
        _charactersService   = new CharactersService(_visualPresets, _uniquePeople, _firstNames, _lastNames);
        _documentsService    = new DocumentsService(_documentPresets);
        _random        = new Random();
        CharacterState = CharacterState.Idle;
        MouseState     = MouseState.Idle;

        _backgroundAnimation = _backgroundGameObject.GetComponent <Animation>();

        _sceneryAnimation = _sceneryGameObject.GetComponent <Animation>();

        // Setup the rules
        var values  = Enum.GetValues(typeof(Country));
        var country = (Country)values.GetValue(_random.Next(values.Length));

        _privilegedCountry  = country;
        _minimumDateOfBirth = new DateTime(1993, 1, 1);

        // Write to the book
        _rulebookController.SetRules(_privilegedCountry, _minimumDateOfBirth);

        RandomCharacter();
    }
 public static void Init()
 {
     Currency   = new CurrencyService();
     Characters = new CharactersService();
     Dungeon    = new DungeonService();
     Inventory  = new InventoryService();
     Time       = TimeProvider.Instance;
 }
        public CharacterListViewModel(IMvxNavigationService navigationService)
        {
            _navigationService = navigationService;
            _charactersService = new CharactersService();
            _characteritems    = new MvxObservableCollection <Character>();

            LoadCharacters();
        }
예제 #6
0
        public static void AddCharactersToDb()
        {
            var dbContext  = new CSharpAdvancedContext();
            var characters = CharactersService.GetCharacters();

            foreach (var character in characters)
            {
                dbContext.Characters.Add(character);
            }

            dbContext.SaveChanges();
            Console.WriteLine("Characters added");
        }
 public AdminCharactersController(CharactersService charactersService)
 {
     _charactersService = charactersService;
 }
예제 #8
0
 public CharactersController(CharactersService charactersService, IWebHostEnvironment hosting)
 {
     _charactersService = charactersService;
     _hosting           = hosting;
 }
예제 #9
0
 public CharacterController(CharactersService charactersService)
 {
     _characterService = charactersService;
 }
예제 #10
0
 public GamesController(GamesService gamesService, CommentsService commentsService, CharactersService charactersService)
 {
     _gamesService      = gamesService;
     _commentsService   = commentsService;
     _charactersService = charactersService;
 }