Skip to content

Commit f7cbdd4

Browse files
author
Justin Skiles
committed
Fixed issue with publishe file details and add unit test
1 parent 6da2692 commit f7cbdd4

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

src/Steam.UnitTests/SteamNewsTests.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
using Microsoft.Extensions.Configuration;
2-
using SteamWebAPI2.Interfaces;
3-
using SteamWebAPI2.Utilities;
4-
using System;
5-
using System.Collections.Generic;
1+
using SteamWebAPI2.Interfaces;
62
using System.Net.Http;
7-
using System.Text;
83
using System.Threading.Tasks;
94
using Xunit;
105

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using SteamWebAPI2.Interfaces;
2+
using System.Net.Http;
3+
using System.Threading.Tasks;
4+
using Xunit;
5+
6+
namespace Steam.UnitTests
7+
{
8+
public class SteamRemoteTests : BaseTest
9+
{
10+
private readonly SteamRemoteStorage steamInterface;
11+
12+
public SteamRemoteTests()
13+
{
14+
steamInterface = factory.CreateSteamWebInterface<SteamRemoteStorage>(new HttpClient());
15+
}
16+
17+
[Fact]
18+
public async Task GetPublishedFileDetailsAsync_Should_Succeed()
19+
{
20+
var response = await steamInterface.GetPublishedFileDetailsAsync(1673456286);
21+
Assert.NotNull(response);
22+
Assert.NotNull(response.Data);
23+
}
24+
}
25+
}

src/SteamWebAPI2/Mappings/SteamRemoteStorageProfile.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public SteamRemoteStorageProfile()
1717
return (PublishedFileVisibility)src;
1818
});
1919
CreateMap<PublishedFileDetails, PublishedFileDetailsModel>()
20-
.ForMember(dest => dest.FileUrl, opts => opts.MapFrom(source => new Uri(source.FileUrl)))
21-
.ForMember(dest => dest.PreviewUrl, opts => opts.MapFrom(source => new Uri(source.PreviewUrl)));
20+
.ForMember(dest => dest.FileUrl, opts => opts.MapFrom(source => !string.IsNullOrWhiteSpace(source.FileUrl) ? new Uri(source.FileUrl) : null))
21+
.ForMember(dest => dest.PreviewUrl, opts => opts.MapFrom(source => !string.IsNullOrWhiteSpace(source.FileUrl) ? new Uri(source.PreviewUrl) : null));
2222
CreateMap<PublishedFileDetailsResultContainer, IReadOnlyCollection<PublishedFileDetailsModel>>()
2323
.ConvertUsing((src, dest, context) =>
2424
context.Mapper.Map<IList<PublishedFileDetails>, IReadOnlyCollection<PublishedFileDetailsModel>>(

0 commit comments

Comments
 (0)