|
| 1 | +using FluentAssertions; |
| 2 | +using NoteBookmark.Domain; |
| 3 | +using Xunit; |
| 4 | + |
| 5 | +namespace NoteBookmark.Api.Tests.Domain; |
| 6 | + |
| 7 | +public class ReadingNoteTests |
| 8 | +{ |
| 9 | + [Fact] |
| 10 | + public void ReadingNote_WhenCreated_HasCorrectDefaultValues() |
| 11 | + { |
| 12 | + // Act |
| 13 | + var readingNote = new ReadingNote(); |
| 14 | + |
| 15 | + // Assert |
| 16 | + readingNote.PostId.Should().BeNull(); |
| 17 | + readingNote.Title.Should().BeNull(); |
| 18 | + readingNote.Url.Should().BeNull(); |
| 19 | + readingNote.Author.Should().BeNull(); |
| 20 | + readingNote.Comment.Should().BeNull(); |
| 21 | + readingNote.Tags.Should().BeNull(); |
| 22 | + readingNote.Category.Should().BeNull(); |
| 23 | + readingNote.ReadingNotesID.Should().BeNull(); |
| 24 | + } |
| 25 | + |
| 26 | + [Fact] |
| 27 | + public void ReadingNote_WhenPropertiesSet_ReturnsCorrectValues() |
| 28 | + { |
| 29 | + // Arrange |
| 30 | + var readingNote = new ReadingNote |
| 31 | + { |
| 32 | + PartitionKey = "reading-notes-123", |
| 33 | + RowKey = "note-456", |
| 34 | + PostId = "post-789", |
| 35 | + Title = "Azure Functions Performance Tips", |
| 36 | + Url = "https://docs.microsoft.com/azure/functions/performance", |
| 37 | + Author = "Azure Team", |
| 38 | + Comment = "Great insights on optimizing Azure Functions", |
| 39 | + Tags = "azure, functions, performance", |
| 40 | + Category = "Performance", |
| 41 | + ReadingNotesID = "reading-notes-123" |
| 42 | + }; |
| 43 | + |
| 44 | + // Assert |
| 45 | + readingNote.PartitionKey.Should().Be("reading-notes-123"); |
| 46 | + readingNote.RowKey.Should().Be("note-456"); |
| 47 | + readingNote.PostId.Should().Be("post-789"); |
| 48 | + readingNote.Title.Should().Be("Azure Functions Performance Tips"); |
| 49 | + readingNote.Url.Should().Be("https://docs.microsoft.com/azure/functions/performance"); |
| 50 | + readingNote.Author.Should().Be("Azure Team"); |
| 51 | + readingNote.Comment.Should().Be("Great insights on optimizing Azure Functions"); |
| 52 | + readingNote.Tags.Should().Be("azure, functions, performance"); |
| 53 | + readingNote.Category.Should().Be("Performance"); |
| 54 | + readingNote.ReadingNotesID.Should().Be("reading-notes-123"); |
| 55 | + } |
| 56 | +} |
0 commit comments