mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-27 04:21:27 +02:00
Initial Push
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Annotations;
|
||||
using NzbDrone.Test.Common;
|
||||
using Prowlarr.Http.ClientSchema;
|
||||
|
||||
namespace NzbDrone.Api.Test.ClientSchemaTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class SchemaBuilderFixture : TestBase
|
||||
{
|
||||
[Test]
|
||||
public void should_return_field_for_every_property()
|
||||
{
|
||||
var schema = SchemaBuilder.ToSchema(new TestModel());
|
||||
schema.Should().HaveCount(2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void schema_should_have_proper_fields()
|
||||
{
|
||||
var model = new TestModel
|
||||
{
|
||||
FirstName = "Bob",
|
||||
LastName = "Poop"
|
||||
};
|
||||
|
||||
var schema = SchemaBuilder.ToSchema(model);
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
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; }
|
||||
|
||||
public string Other { get; set; }
|
||||
}
|
||||
}
|
20
src/Prowlarr.Api.V1.Test/Prowlarr.Api.V1.Test.csproj
Normal file
20
src/Prowlarr.Api.V1.Test/Prowlarr.Api.V1.Test.csproj
Normal file
@@ -0,0 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net462;netcoreapp3.1</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1" />
|
||||
<PackageReference Include="NunitXml.TestLogger" Version="2.1.41" />
|
||||
<PackageReference Include="NBuilder" Version="6.1.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
|
||||
<PackageReference Include="coverlet.collector" Version="1.2.1" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NzbDrone.Core\Prowlarr.Core.csproj" />
|
||||
<ProjectReference Include="..\NzbDrone.Test.Common\Prowlarr.Test.Common.csproj" />
|
||||
<ProjectReference Include="..\Prowlarr.Http\Prowlarr.Http.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
2
src/Prowlarr.Api.V1.Test/app.config
Normal file
2
src/Prowlarr.Api.V1.Test/app.config
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration />
|
Reference in New Issue
Block a user