mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
Added Fluent.cs to allow string default extention method eg. "Series.Title.WithDefault(series.SeriesId)"
This commit is contained in:
parent
ed4976de90
commit
b00e437e56
5 changed files with 71 additions and 3 deletions
43
NzbDrone.Core.Test/FluentTest.cs
Normal file
43
NzbDrone.Core.Test/FluentTest.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.ServiceModel.Syndication;
|
||||
using AutoMoq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Providers.Indexer;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
public class FluentTest : TestBase
|
||||
{
|
||||
[TestCase(null, "def", "def")]
|
||||
[TestCase("", "def", "def")]
|
||||
[TestCase("", 1, "1")]
|
||||
[TestCase(null, "", "")]
|
||||
[TestCase("actual", "def", "actual")]
|
||||
public void WithDefault_success(string actual, object defaultValue, string result)
|
||||
{
|
||||
actual.WithDefault(defaultValue).Should().Be(result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public void WithDefault_Fail()
|
||||
{
|
||||
"test".WithDefault(null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue