30 lines
977 B
C#
30 lines
977 B
C#
using QuestionsApi.Models;
|
|
using Xunit;
|
|
|
|
namespace QuestionsApi.Tests;
|
|
|
|
public sealed class QuestionBookmarkTests
|
|
{
|
|
[Fact]
|
|
public void PublicResponsesDoNotExposeUserOrMongoIdentifiers()
|
|
{
|
|
Assert.Null(typeof(QuestionBookmarkSummary).GetProperty(nameof(QuestionBookmark.UserId)));
|
|
Assert.Null(typeof(QuestionBookmarkSummary).GetProperty(nameof(QuestionBookmark.Id)));
|
|
Assert.Null(typeof(QuestionBookmarkMutationResponse).GetProperty(nameof(QuestionBookmark.UserId)));
|
|
Assert.Null(typeof(QuestionBookmarkMutationResponse).GetProperty(nameof(QuestionBookmark.Id)));
|
|
}
|
|
|
|
[Fact]
|
|
public void QuestionResponseDefaultsToNotBookmarked()
|
|
{
|
|
var response = QuestionResponse.FromModel(new Question
|
|
{
|
|
ExternalId = "bookmark-test",
|
|
Choices = [new QuestionChoice { Id = "A", Text = "Answer" }],
|
|
CorrectChoiceId = "A"
|
|
});
|
|
|
|
Assert.False(response.IsBookmarked);
|
|
}
|
|
}
|