You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.7 KiB
74 lines
1.7 KiB
using Tiobon.Core.IServices;
|
|
using Tiobon.Core.Model.Models;
|
|
using Xunit;
|
|
using System;
|
|
using System.Linq;
|
|
using Autofac;
|
|
|
|
namespace Tiobon.Core.Tests
|
|
{
|
|
public class TiobonArticleService_Should
|
|
{
|
|
|
|
private ITiobonArticleServices TiobonArticleServices;
|
|
DI_Test dI_Test = new DI_Test();
|
|
|
|
|
|
public TiobonArticleService_Should()
|
|
{
|
|
//mockTiobonRep.Setup(r => r.Query());
|
|
|
|
var container = dI_Test.DICollections();
|
|
|
|
TiobonArticleServices = container.Resolve<ITiobonArticleServices>();
|
|
|
|
}
|
|
|
|
|
|
[Fact]
|
|
public void TiobonArticleServices_Test()
|
|
{
|
|
Assert.NotNull(TiobonArticleServices);
|
|
}
|
|
|
|
|
|
[Fact]
|
|
public async void Get_Tiobons_Test()
|
|
{
|
|
var data = await TiobonArticleServices.GetTiobons();
|
|
|
|
Assert.True(data.Any());
|
|
}
|
|
|
|
[Fact]
|
|
public async void Add_Tiobon_Test()
|
|
{
|
|
TiobonArticle TiobonArticle = new TiobonArticle()
|
|
{
|
|
bCreateTime = DateTime.Now,
|
|
bUpdateTime = DateTime.Now,
|
|
btitle = "xuint test title",
|
|
bcontent = "xuint test content",
|
|
bsubmitter = "xuint test submitter",
|
|
};
|
|
|
|
var BId = await TiobonArticleServices.Add(TiobonArticle);
|
|
|
|
Assert.True(BId > 0);
|
|
}
|
|
|
|
[Fact]
|
|
public async void Delete_Tiobon_Test()
|
|
{
|
|
Add_Tiobon_Test();
|
|
|
|
var deleteModel = (await TiobonArticleServices.Query(d => d.btitle == "xuint test title")).FirstOrDefault();
|
|
|
|
Assert.NotNull(deleteModel);
|
|
|
|
var IsDel = await TiobonArticleServices.Delete(deleteModel);
|
|
|
|
Assert.True(IsDel);
|
|
}
|
|
}
|
|
}
|
|
|