2023-02-19 21:39:03 -08:00
|
|
|
using Microsoft.Extensions.Configuration;
|
2023-02-16 22:19:05 -08:00
|
|
|
using Newsbot.Collector.Database.Repositories;
|
|
|
|
using Newsbot.Collector.Domain.Models;
|
|
|
|
|
|
|
|
namespace Newsbot.Collector.Tests.Tables;
|
|
|
|
|
|
|
|
public class SettingsTableTests
|
|
|
|
{
|
2023-02-19 21:39:03 -08:00
|
|
|
private IConfiguration GetConfiguration()
|
|
|
|
{
|
|
|
|
var inMemorySettings = new Dictionary<string, string> {
|
|
|
|
{"ConnectionStrings:database", "Host=localhost;Username=postgres;Password=postgres;Database=postgres;sslmode=disable"}
|
|
|
|
};
|
|
|
|
|
|
|
|
IConfiguration configuration = new ConfigurationBuilder()
|
|
|
|
.AddInMemoryCollection(inMemorySettings)
|
|
|
|
.Build();
|
|
|
|
return configuration;
|
|
|
|
}
|
2023-02-16 22:19:05 -08:00
|
|
|
[Fact]
|
|
|
|
public void New()
|
|
|
|
{
|
2023-02-19 21:39:03 -08:00
|
|
|
var cfg = GetConfiguration();
|
|
|
|
var client = new SettingsTable(cfg);
|
2023-02-16 22:19:05 -08:00
|
|
|
client.New(new SettingModel
|
|
|
|
{
|
|
|
|
Key = "Unit Testing",
|
|
|
|
Value = "Unit",
|
|
|
|
Options = ""
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|