WYB
2021-03-22 91b8cdad021ab052e4991f3d41834a6f0ddc36b8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using JiepeiWMS.IServices;
using JiepeiWMS.Model.Models;
using Xunit;
using System;
using System.Linq;
using Autofac;
 
namespace JiepeiWMS.Tests
{
    public class BlogArticleService_Should
    {
 
        private IBlogArticleServices blogArticleServices;
        DI_Test dI_Test = new DI_Test();
 
 
        public BlogArticleService_Should()
        {
            //mockBlogRep.Setup(r => r.Query());
 
            var container = dI_Test.DICollections();
 
            blogArticleServices = container.Resolve<IBlogArticleServices>();
 
        }
 
 
        [Fact]
        public void BlogArticleServices_Test()
        {
            Assert.NotNull(blogArticleServices);
        }
 
 
        [Fact]
        public async void Get_Blogs_Test()
        {
            var data = await blogArticleServices.GetBlogs();
 
            Assert.True(data.Any());
        }
 
        [Fact]
        public async void Add_Blog_Test()
        {
            BlogArticle blogArticle = new BlogArticle()
            {
                bCreateTime = DateTime.Now,
                bUpdateTime = DateTime.Now,
                btitle = "xuint test title",
                bcontent = "xuint test content",
                bsubmitter = "xuint test submitter",
            };
 
            var BId = await blogArticleServices.Add(blogArticle);
 
            Assert.True(BId > 0);
        }
 
        [Fact]
        public async void Delete_Blog_Test()
        {
            var deleteModel = (await blogArticleServices.Query(d => d.btitle == "xuint test title")).FirstOrDefault();
 
            Assert.NotNull(deleteModel);
 
            var IsDel = await blogArticleServices.Delete(deleteModel);
 
            Assert.True(IsDel);
        }
    }
}