Newsbot.Collector/Newsbot.Collector.Tests/Tables/ArticlesTableTests.cs

40 lines
880 B
C#
Raw Normal View History

using Newsbot.Collector.Database.Repositories;
using Newsbot.Collector.Domain.Models;
namespace Newsbot.Collector.Tests.Tables;
public class ArticlesTableTests
{
[Fact]
public void ArticlesListTest()
{
var client = new ArticlesTable("");
client.List();
}
[Fact]
public void GetByIDTest()
{
var uid = Guid.Parse("4ac46772-253c-4c3d-8a2c-29239abd2ad4");
var client = new ArticlesTable("");
var res = client.GetById(uid);
if (!res.ID.Equals(uid))
{
Assert.Fail("Incorrect record or not found");
}
}
[Fact]
public void NewRecordTest()
{
var client = new ArticlesTable("");
client.New(new ArticlesModel
{
Title = "Unit Testing!",
SourceID = Guid.NewGuid(),
PubDate = DateTime.Now
});
}
}