Ejemplo n.º 1
0
        public async Task Reset_Success()
        {
            _mockRateLimit.Setup(x => x.IsTurnedOn).Returns(false);

            _mockHeaderManager.Setup(x => x.Update(It.IsAny <IReadOnlyNameValueList <string> >()));
            _mockHeaderManager.Setup(x => x.Get <int>(ResponseHeader.TotalCount)).Returns(2000);
            _mockHeaderManager.Setup(x => x.Get <int>(ResponseHeader.PageSize)).Returns(1000);

            var rootSetList = new RootSetDto()
            {
                Set = new SetDto(),
            };

            using var httpTest = new HttpTest();
            httpTest.RespondWithJson(rootSetList);

            _mockModelMapper.Setup(x => x.MapSet(It.IsAny <SetDto>())).Returns(new Set());

            var service = new SetService(
                _mockHeaderManager.Object,
                _mockModelMapper.Object,
                ApiVersion.V1,
                _mockRateLimit.Object);

            service.Where(x => x.Name, "test");

            // act
            service.Reset();

            // assert
            await service.AllAsync();

            httpTest.ShouldHaveCalled("https://api.magicthegathering.io/v1/sets");
        }