Newsbot.Collector/Newsbot.Collector.Tests/Tables/SettingsTableTests.cs

32 lines
916 B
C#
Raw Normal View History

using Microsoft.Extensions.Configuration;
using Newsbot.Collector.Database.Repositories;
using Newsbot.Collector.Domain.Models;
namespace Newsbot.Collector.Tests.Tables;
public class SettingsTableTests
{
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;
}
[Fact]
public void New()
{
var cfg = GetConfiguration();
var client = new SettingsTable(cfg);
client.New(new SettingModel
{
Key = "Unit Testing",
Value = "Unit",
Options = ""
});
}
}