public void SetUp()
        {
            MonsterId  = Fixture.Create <int>();
            MonsterApi = Fixture.Build <MonsterApi>()
                         .With(x => x.Id, MonsterId)
                         .Create();
            MonstersApi = new List <MonsterApi>()
            {
                Fixture.Create <MonsterApi>(),
                Fixture.Create <MonsterApi>(),
                MonsterApi
            };

            Monster = Fixture.Build <Monster>()
                      .With(x => x.Id, MonsterId)
                      .Create();
            Monsters = Fixture.Build <Monsters>()
                       .With(x => x.MonsterList, new List <Monster>()
            {
                Fixture.Create <Monster>(),
                Fixture.Create <Monster>(),
                Monster
            })
                       .Create();

            MonstersApiJson = Serialize.ToJson(MonstersApi.ToList());
            MhwDbApiClient.Get("monsters").Returns(MonstersApiJson);
            MhwDbApiMapper.Map(Arg.Any <List <MonsterApi> >()).Returns(Monsters);
        }
Exemple #2
0
        public async Task <Monsters> Get()
        {
            if (_monsters == null || DateTime.Compare(_dateInit.AddDays(7), DateTime.Now) < 0)
            {
                var response = await _mhwDbApiClient.Get("monsters");

                List <MonsterApi> result = new List <MonsterApi>(MonsterApi.FromJson(response));
                _monsters          = _mhwDbApiMapper.Map(result);
                _dateInit          = DateTime.Now;
                _monsters.DateInit = _dateInit;
            }
            return(_monsters);
        }
 public MonsterApiTests()
 {
     _api = new MonsterApi(_repositoryMock.Object, _loggerMock.Object);
 }