33 lines
793 B
C#
33 lines
793 B
C#
using GameAuthApi.Services;
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
public class ServiceValidationTests
|
|
{
|
|
private static IConfiguration cfg = new ConfigurationBuilder()
|
|
.AddInMemoryCollection(new Dictionary<string,string>
|
|
{
|
|
{"MongoDB:ConnectionString","mongodb://localhost"},
|
|
{"MongoDB:DatabaseName","test"}
|
|
}).Build();
|
|
|
|
[Fact]
|
|
public async Task ItemService_InvalidId_ReturnsNull()
|
|
{
|
|
var svc = new ItemService(cfg);
|
|
|
|
var result = await svc.GetByIdAsync("bad");
|
|
|
|
Assert.Null(result);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task AuctionService_InvalidId_ReturnsNull()
|
|
{
|
|
var svc = new AuctionService(cfg);
|
|
|
|
var result = await svc.GetByIdAsync("bad");
|
|
|
|
Assert.Null(result);
|
|
}
|
|
}
|