Add isolated UAT and production environments
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using MongoDB.Bson;
|
||||
using QuestionsApi.Services;
|
||||
using Xunit;
|
||||
|
||||
namespace QuestionsApi.Tests;
|
||||
|
||||
public sealed class ContentPromotionTests
|
||||
{
|
||||
[Fact]
|
||||
public void CollectMediaIdsDeduplicatesValidObjectIds()
|
||||
{
|
||||
var id = ObjectId.GenerateNewId();
|
||||
var questions = new[]
|
||||
{
|
||||
new BsonDocument("Media", new BsonArray { id.ToString(), "not-an-object-id" }),
|
||||
new BsonDocument("Media", new BsonArray { id.ToString() })
|
||||
};
|
||||
|
||||
var result = ContentPromotionCommand.CollectMediaIds(questions);
|
||||
|
||||
Assert.Equal(new[] { id }, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ContentHashDoesNotDependOnInputOrder()
|
||||
{
|
||||
var first = new BsonDocument { ["ExternalId"] = "a", ["Stem"] = "one" };
|
||||
var second = new BsonDocument { ["ExternalId"] = "b", ["Stem"] = "two" };
|
||||
|
||||
Assert.Equal(
|
||||
ContentPromotionCommand.HashDocuments([first, second]),
|
||||
ContentPromotionCommand.HashDocuments([second, first]));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user