-
Notifications
You must be signed in to change notification settings - Fork 158
Expand file tree
/
Copy pathBlogResponsesTests.cs
More file actions
38 lines (32 loc) · 1.08 KB
/
BlogResponsesTests.cs
File metadata and controls
38 lines (32 loc) · 1.08 KB
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
using Moq;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WebGoatCore.Data;
using WebGoatCore.Models;
namespace WebGoat.NET.Tests.BlogRespRepositoryTests
{
[TestFixture]
public class BlogResponsesTests
{
Mock<NorthwindContext> _context;
[SetUp]
public void Setup()
{
_context = ContextSetup.CreateContext();
}
[Test]
public void CreateBlogRespTest()
{
var blogEntryRepo = new BlogEntryRepository(_context.Object);
var entry1 = blogEntryRepo.GetBlogEntry(1);
var respRepo = new BlogResponseRepository(_context.Object);
var resp = new BlogResponse() { Author = "admin", Contents = "Test", Id = 4, ResponseDate = DateTime.Now, BlogEntry = entry1, BlogEntryId = entry1.Id };
respRepo.CreateBlogResponse(resp);
Assert.That(_context.Object.BlogResponses.Count(), Is.EqualTo(4));
}
}
}