diff options
author | 杨宇千 <crupest@outlook.com> | 2019-08-19 16:12:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-19 16:12:16 +0800 |
commit | 134173eda92de04961dc69757b257c1c547d88a4 (patch) | |
tree | bd8c0d70aac7cd4d1a6c28ae7c9b7c681dbd5613 /Timeline.Tests/DatabaseTest.cs | |
parent | 24fe6340ea69321ecafb57c8c5d6cd4b72f229b4 (diff) | |
parent | 79e578e97ed252bff0dca3c89d81a395b35289d7 (diff) | |
download | timeline-134173eda92de04961dc69757b257c1c547d88a4.tar.gz timeline-134173eda92de04961dc69757b257c1c547d88a4.tar.bz2 timeline-134173eda92de04961dc69757b257c1c547d88a4.zip |
Merge pull request #45 from crupest/avatar-cache
Add 304 response for If-Modified-Since in avatar.
Diffstat (limited to 'Timeline.Tests/DatabaseTest.cs')
-rw-r--r-- | Timeline.Tests/DatabaseTest.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Timeline.Tests/DatabaseTest.cs b/Timeline.Tests/DatabaseTest.cs new file mode 100644 index 00000000..e280637c --- /dev/null +++ b/Timeline.Tests/DatabaseTest.cs @@ -0,0 +1,37 @@ +using FluentAssertions;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Linq;
+using Timeline.Entities;
+using Timeline.Tests.Mock.Data;
+using Xunit;
+
+namespace Timeline.Tests
+{
+ public class DatabaseTest : IDisposable
+ {
+ private readonly TestDatabase _database;
+ private readonly DatabaseContext _context;
+
+ public DatabaseTest()
+ {
+ _database = new TestDatabase();
+ _context = _database.DatabaseContext;
+ }
+
+ public void Dispose()
+ {
+ _database.Dispose();
+ }
+
+ [Fact]
+ public void DeleteUserShouldAlsoDeleteAvatar()
+ {
+ _context.UserAvatars.Count().Should().Be(2);
+ var user = _context.Users.First();
+ _context.Users.Remove(user);
+ _context.SaveChanges();
+ _context.UserAvatars.Count().Should().Be(1);
+ }
+ }
+}
|