Fixing 500 error when entering a bad itemid when creating an auction
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user