mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 06:11:10 +00:00
Adds authorization module tests
This commit is contained in:
1 parent
718e1c49cf
commit
0114ff13e8
125 files changed
+10411
-203
No files matched your search
+19
-11
@@ -32,8 +32,10 @@ public class LibraryEntityMappingTests
|
||||
new() { Path = "C:/Books" },
|
||||
new() { Path = "D:/Media/Books" }
|
||||
],
|
||||
Created = DateTime.UtcNow,
|
||||
Updated = null
|
||||
CreatedOnUtc = DateTime.UtcNow,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
UpdatedOnUtc = null,
|
||||
UpdatedBy = null
|
||||
};
|
||||
|
||||
// Act
|
||||
@@ -46,8 +48,8 @@ public class LibraryEntityMappingTests
|
||||
result.Title.Should().Be(entity.Title);
|
||||
result.LibraryType.Should().Be(entity.LibraryType);
|
||||
result.ContentLocations.Should().BeEquivalentTo(entity.ContentLocations.Select(l => l.Path));
|
||||
result.Created.Should().Be(entity.Created);
|
||||
result.Updated.Should().Be(entity.Updated);
|
||||
result.CreatedOnUtc.Should().Be(entity.CreatedOnUtc);
|
||||
result.UpdatedOnUtc.Should().Be(entity.UpdatedOnUtc);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -65,8 +67,10 @@ public class LibraryEntityMappingTests
|
||||
Title = "My Library",
|
||||
LibraryType = libraryType,
|
||||
ContentLocations = [new() { Path = "C:/Media" }],
|
||||
Created = DateTime.UtcNow,
|
||||
Updated = null
|
||||
CreatedOnUtc = DateTime.UtcNow,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
UpdatedOnUtc = null,
|
||||
UpdatedBy = null
|
||||
};
|
||||
|
||||
// Act
|
||||
@@ -94,8 +98,10 @@ public class LibraryEntityMappingTests
|
||||
new() { Path = "E:/Digital Library/Books" },
|
||||
new() { Path = "F:/Reading Material" }
|
||||
],
|
||||
Created = DateTime.UtcNow,
|
||||
Updated = null
|
||||
CreatedOnUtc = DateTime.UtcNow,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
UpdatedOnUtc = null,
|
||||
UpdatedBy = null
|
||||
};
|
||||
|
||||
// Act
|
||||
@@ -118,8 +124,10 @@ public class LibraryEntityMappingTests
|
||||
Title = "My Library",
|
||||
LibraryType = LibraryType.Book,
|
||||
ContentLocations = [new() { Path = "C:/Books" }],
|
||||
Created = DateTime.UtcNow,
|
||||
Updated = updated
|
||||
CreatedOnUtc = DateTime.UtcNow,
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
UpdatedOnUtc = updated,
|
||||
UpdatedBy = Guid.NewGuid()
|
||||
};
|
||||
|
||||
// Act
|
||||
@@ -127,6 +135,6 @@ public class LibraryEntityMappingTests
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNull();
|
||||
result.Updated.Should().Be(updated);
|
||||
result.UpdatedOnUtc.Should().Be(updated);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -44,8 +44,8 @@ public class LibraryMappingTests
|
||||
result.LibraryType.Should().Be(library.LibraryType);
|
||||
result.ContentLocations.Select(l => l.Path)
|
||||
.Should().BeEquivalentTo(library.ContentLocations.Select(l => l.Path));
|
||||
result.Created.Should().Be(library.Created);
|
||||
result.Updated.Should().Be(library.Updated.HasValue ? library.Updated : null);
|
||||
result.CreatedOnUtc.Should().Be(library.CreatedOnUtc);
|
||||
result.UpdatedOnUtc.Should().Be(library.UpdatedOnUtc.HasValue ? library.UpdatedOnUtc : null);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
+2
-2
@@ -72,7 +72,7 @@ public class BookMappingTests
|
||||
result.AppleBooksId.Should().Be(book.AppleBooksId.HasValue ? book.AppleBooksId.Value : null);
|
||||
result.ISBNs.Should().BeEquivalentTo(book.ISBNs.ToRepositoryEntities());
|
||||
result.Ratings.Should().BeEquivalentTo(book.Ratings.ToRepositoryEntities());
|
||||
result.Created.Should().Be(book.Created);
|
||||
result.Updated.Should().Be(book.Updated.HasValue ? book.Updated.Value : null);
|
||||
result.CreatedOnUtc.Should().Be(book.CreatedOnUtc);
|
||||
result.UpdatedOnUtc.Should().Be(book.UpdatedOnUtc.HasValue ? book.UpdatedOnUtc.Value : null);
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -248,15 +248,15 @@ public class BookEntityMappingTests
|
||||
else
|
||||
result.Value.AppleBooksId.HasValue.Should().BeFalse();
|
||||
|
||||
result.Value.Created.Should().Be(bookEntity.Created);
|
||||
result.Value.CreatedOnUtc.Should().Be(bookEntity.CreatedOnUtc);
|
||||
|
||||
if (bookEntity.Updated.HasValue)
|
||||
if (bookEntity.UpdatedOnUtc.HasValue)
|
||||
{
|
||||
result.Value.Updated.HasValue.Should().BeTrue();
|
||||
result.Value.Updated!.Value.Should().Be(bookEntity.Updated.Value);
|
||||
result.Value.UpdatedOnUtc.HasValue.Should().BeTrue();
|
||||
result.Value.UpdatedOnUtc!.Value.Should().Be(bookEntity.UpdatedOnUtc.Value);
|
||||
}
|
||||
else
|
||||
result.Value.Updated.HasValue.Should().BeFalse();
|
||||
result.Value.UpdatedOnUtc.HasValue.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -304,8 +304,8 @@ public class BookEntityMappingTests
|
||||
result.AppleBooksId.Should().Be(bookEntity.AppleBooksId);
|
||||
result.ISBNs.Should().BeEquivalentTo(bookEntity.ISBNs);
|
||||
result.Ratings.Should().BeEquivalentTo(bookEntity.Ratings);
|
||||
result.Created.Should().Be(bookEntity.Created);
|
||||
result.Updated.Should().Be(bookEntity.Updated);
|
||||
result.CreatedOnUtc.Should().Be(bookEntity.CreatedOnUtc);
|
||||
result.UpdatedOnUtc.Should().Be(bookEntity.UpdatedOnUtc);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in new issue
Block a user