mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.3 KiB
49 lines
1.3 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using MongoDB.Bson.Serialization.Attributes;
|
|
using Xunit;
|
|
|
|
namespace Squidex.Infrastructure.MongoDb
|
|
{
|
|
public class MongoFieldTests
|
|
{
|
|
public sealed class Entity
|
|
{
|
|
public string Id { get; set; }
|
|
|
|
public string Default { get; set; }
|
|
|
|
[BsonElement("_c")]
|
|
public string Custom { get; set; }
|
|
}
|
|
|
|
[Fact]
|
|
public void Should_resolve_id_field()
|
|
{
|
|
var name = Field.Of<Entity>(x => nameof(x.Id));
|
|
|
|
Assert.Equal("_id", name);
|
|
}
|
|
|
|
[Fact]
|
|
public void Should_resolve_default_field()
|
|
{
|
|
var name = Field.Of<Entity>(x => nameof(x.Default));
|
|
|
|
Assert.Equal("Default", name);
|
|
}
|
|
|
|
[Fact]
|
|
public void Should_resolve_custom_field()
|
|
{
|
|
var name = Field.Of<Entity>(x => nameof(x.Custom));
|
|
|
|
Assert.Equal("_c", name);
|
|
}
|
|
}
|
|
}
|
|
|