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.
46 lines
1.4 KiB
46 lines
1.4 KiB
6 years ago
|
using FluentAssertions;
|
||
12 years ago
|
using NUnit.Framework;
|
||
12 years ago
|
using NzbDrone.Core.Annotations;
|
||
12 years ago
|
using NzbDrone.Test.Common;
|
||
4 years ago
|
using Prowlarr.Http.ClientSchema;
|
||
12 years ago
|
|
||
|
namespace NzbDrone.Api.Test.ClientSchemaTests
|
||
|
{
|
||
|
[TestFixture]
|
||
|
public class SchemaBuilderFixture : TestBase
|
||
|
{
|
||
|
[Test]
|
||
|
public void should_return_field_for_every_property()
|
||
|
{
|
||
11 years ago
|
var schema = SchemaBuilder.ToSchema(new TestModel());
|
||
12 years ago
|
schema.Should().HaveCount(2);
|
||
|
}
|
||
|
|
||
|
[Test]
|
||
|
public void schema_should_have_proper_fields()
|
||
|
{
|
||
|
var model = new TestModel
|
||
5 years ago
|
{
|
||
|
FirstName = "Bob",
|
||
|
LastName = "Poop"
|
||
|
};
|
||
12 years ago
|
|
||
11 years ago
|
var schema = SchemaBuilder.ToSchema(model);
|
||
12 years ago
|
|
||
5 years ago
|
schema.Should().Contain(c => c.Order == 1 && c.Name == "lastName" && c.Label == "Last Name" && c.HelpText == "Your Last Name" && (string)c.Value == "Poop");
|
||
|
schema.Should().Contain(c => c.Order == 0 && c.Name == "firstName" && c.Label == "First Name" && c.HelpText == "Your First Name" && (string)c.Value == "Bob");
|
||
12 years ago
|
}
|
||
|
}
|
||
|
|
||
|
public class TestModel
|
||
|
{
|
||
|
[FieldDefinition(0, Label = "First Name", HelpText = "Your First Name")]
|
||
|
public string FirstName { get; set; }
|
||
|
|
||
|
[FieldDefinition(1, Label = "Last Name", HelpText = "Your Last Name")]
|
||
|
public string LastName { get; set; }
|
||
12 years ago
|
|
||
|
public string Other { get; set; }
|
||
12 years ago
|
}
|
||
6 years ago
|
}
|