Add some unit test for stubs
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
b61e56fe5f
commit
6910fb2594
@ -0,0 +1,38 @@
|
||||
using Model;
|
||||
using Model.Stub;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NuGet.Frameworks;
|
||||
|
||||
namespace TestUnitaires
|
||||
{
|
||||
|
||||
public class TU_StubArtist
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("test")]
|
||||
public void TU_Attributes(string test)
|
||||
{
|
||||
StubArtist stubArtist = new StubArtist();
|
||||
List<Artist> artists = new List<Artist>() { new Artist("Imagine Dragons"), new Artist("Nepal"), new Artist("Hugo TSR"), new Artist("Booba"), new Artist("Oxmo Puccino"), new Artist("IAM"), new Artist("PNL") };
|
||||
Assert.Equal(stubArtist.Artists, artists);
|
||||
}
|
||||
[Theory]
|
||||
[InlineData("test")]
|
||||
public void TU_Methods(string test)
|
||||
{
|
||||
StubArtist stubArtist = new StubArtist();
|
||||
List<Artist> list = new List<Artist>();
|
||||
Artist artist = new Artist("Un mec");
|
||||
Assert.Empty(list);
|
||||
stubArtist.AddArtist(artist);
|
||||
Assert.Contains(artist, stubArtist.Artists);
|
||||
stubArtist.RemoveArtist(artist);
|
||||
Assert.DoesNotContain(artist, stubArtist.Artists);
|
||||
artist = stubArtist.GetArtistByName("Nepal");
|
||||
Assert.Contains(artist,stubArtist.Artists);
|
||||
list = stubArtist.GetArtists();
|
||||
Assert.Equal(list, stubArtist.Artists);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
using Model;
|
||||
using Model.Stub;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NuGet.Frameworks;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace TestUnitaires
|
||||
{
|
||||
|
||||
public class TU_StubInfoTitle
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("test")]
|
||||
public void TU_Methods(string test)
|
||||
{
|
||||
StubInfoTitle sit = new StubInfoTitle();
|
||||
List<InfoTitle> list = new List<InfoTitle>();
|
||||
Artist artist = new Artist("Un mec");
|
||||
ObservableCollection<InfoTitle> collec = new ObservableCollection<InfoTitle>();
|
||||
InfoTitle info = new InfoTitle("Titre Sympa", "url.test", "infos", "desc", Genre.POP, 345);
|
||||
list = sit.GetInfoTitlesByNames(new List<string>{ "Dégradation"});
|
||||
Assert.NotEmpty(list);
|
||||
sit.AddInfoTitle(info);
|
||||
Assert.Contains(info, sit.InfoTitles);
|
||||
sit.RemoveInfoTitle(info);
|
||||
Assert.DoesNotContain(info, sit.InfoTitles);
|
||||
collec = sit.GetInfoTitles();
|
||||
Assert.Equal(sit.InfoTitles, collec);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue