Esempio n. 1
0
        public async Task ShouldReturnNullIfServiceReturnsNull()
        {
            var service = Substitute.For <IPoeApiService>();

            var sut      = new GetStashTabItems.Handler(service);
            var response = await sut.Handle(new GetStashTabItems.Request());

            response.Should().BeNull();
        }
Esempio n. 2
0
        public async Task ShouldGetStashItemsFromPoeEndpointUsingGetStashTabItemsRequest()
        {
            var service = Substitute.For <IPoeApiService>();

            var request = new GetStashTabItems.Request
            {
                AccountName  = "SomeAccountName",
                PoeSessionId = "someId",
                TabIndex     = "1"
            };

            var sut = new GetStashTabItems.Handler(service);

            await sut.Handle(request);

            await service.Received(1).GetStashTabItems(request);
        }
Esempio n. 3
0
        public async Task ShouldConvertTypeLineProperty()
        {
            var service = Substitute.For <IPoeApiService>();

            var request = new GetStashTabItems.Request
            {
                AccountName  = "SomeAccountName",
                PoeSessionId = "someId",
                TabIndex     = "1"
            };
            var expectedResponse = CreateGetStashTabItemsResponse(typeLine: "type line");

            service.GetStashTabItems(request).Returns(CreateGetStashTabItemsHttpResponseMessage(expectedResponse));

            var sut      = new GetStashTabItems.Handler(service);
            var response = await sut.Handle(request);

            response.Should().BeEquivalentTo(expectedResponse);
        }
Esempio n. 4
0
        public async Task ShouldConvertImplicitProperty()
        {
            var service = Substitute.For <IPoeApiService>();

            var request = new GetStashTabItems.Request
            {
                AccountName  = "SomeAccountName",
                PoeSessionId = "someId",
                TabIndex     = "1"
            };
            var implicitMods = new List <string>
            {
                "mod1",
                "mod2"
            };
            var expectedResponse = CreateGetStashTabItemsResponse(implicitMods: implicitMods);

            service.GetStashTabItems(request).Returns(CreateGetStashTabItemsHttpResponseMessage(expectedResponse));

            var sut      = new GetStashTabItems.Handler(service);
            var response = await sut.Handle(request);

            response.Should().BeEquivalentTo(expectedResponse);
        }