From 835a7a54b2125638930ec2506575aa8157c9885b Mon Sep 17 00:00:00 2001 From: Louis LABORIE Date: Wed, 10 May 2023 17:22:43 +0200 Subject: [PATCH] Add InfoTitle's UT --- Sources/TestUnitaires/TU_InfoTitle.cs | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Sources/TestUnitaires/TU_InfoTitle.cs diff --git a/Sources/TestUnitaires/TU_InfoTitle.cs b/Sources/TestUnitaires/TU_InfoTitle.cs new file mode 100644 index 0000000..49727a8 --- /dev/null +++ b/Sources/TestUnitaires/TU_InfoTitle.cs @@ -0,0 +1,45 @@ +using Model; +using Newtonsoft.Json.Linq; +using NuGet.Frameworks; + +namespace TestUnitaires +{ + + public class TU_InfoTitle + { + [Theory] + [InlineData("Trajectoire","morceau1.png","Sortie : 2020","Morceau de Népal",Genre.HIP_HOP)] + [InlineData(null, "morceau1.png", "Sortie : 2020", "Morceau de Népal", Genre.HIP_HOP)] + [InlineData("Trajectoire", null, "Sortie : 2020", "Morceau de Népal", Genre.HIP_HOP)] + [InlineData("Trajectoire", "morceau1.png", null, "Morceau de Népal", Genre.HIP_HOP)] + [InlineData("Trajectoire", "morceau1png", "Sortie : 2020", "Morceau de Népal", Genre.HIP_HOP)] + [InlineData("Trajectoire", "morceau1. png", "Sortie : 2020", "Morceau de Népal", Genre.HIP_HOP)] + public void TU_Attributes(string name, string url, string info, string desc, Genre g) + { + InfoTitle it = new InfoTitle(name, url, info, new Artiste("test"), desc, g); + Assert.True(it.Name != null && it.Name.Length < 75); + Assert.True(it.ImageURL != null && it.ImageURL.Contains('.')); + Assert.False(it.ImageURL.Contains(' ')); + Assert.True(it.Information != null && it.Information.Length < 500); + Assert.True(it.Description != null && it.Description.Length < 500); + } + + [Theory] + [InlineData("Trajectoire", "morceau1.png", "Sortie : 2020", "Morceau de Népal", Genre.HIP_HOP)] + [InlineData(null, "morceau1.png", "Sortie : 2020", "Morceau de Népal", Genre.HIP_HOP)] + [InlineData("Trajectoire", null, "Sortie : 2020", "Morceau de Népal", Genre.HIP_HOP)] + [InlineData("Trajectoire", "morceau1.png", null, "Morceau de Népal", Genre.HIP_HOP)] + [InlineData("Trajectoire", "morceau1png", "Sortie : 2020", "Morceau de Népal", Genre.HIP_HOP)] + [InlineData("Trajectoire", "morceau1. png", "Sortie : 2020", "Morceau de Népal", Genre.HIP_HOP)] + public void TU_Methods(string name, string url, string info, string desc, Genre g) + { + InfoTitle it = new InfoTitle(name, url, info, new Artiste("test"), desc, g); + Artiste a = new Artiste("Lahuiss"); + it.AddFeat(a); + Assert.Contains(a, it.Feat); + it.RemoveFeat(a); + Assert.DoesNotContain(a, it.Feat); + } + } + +} \ No newline at end of file