delete previous
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
44f991f6ef
commit
a2cc142faa
@ -1,24 +0,0 @@
|
|||||||
using Models;
|
|
||||||
|
|
||||||
namespace Tests
|
|
||||||
{
|
|
||||||
public class AbilityTests
|
|
||||||
{
|
|
||||||
[Fact]
|
|
||||||
public void Ability_Constructor_SetsProperties()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
string name = "Capacité 1";
|
|
||||||
string image = "image1.png";
|
|
||||||
string description = "Description de la capacité";
|
|
||||||
|
|
||||||
// Act
|
|
||||||
var ability = new Ability(name, image, description);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
Assert.Equal(name, ability.Name);
|
|
||||||
Assert.Equal(image, ability.Image);
|
|
||||||
Assert.Equal(description, ability.Description);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
using Models;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Tests
|
|
||||||
{
|
|
||||||
public class ChampionTests
|
|
||||||
{
|
|
||||||
[Fact]
|
|
||||||
public void Champion_ConstructorWithAbilities_SetsProperties()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
string name = "Champion 1";
|
|
||||||
string titre = "Titre du champion";
|
|
||||||
string image = "image1.png";
|
|
||||||
var abilities = new List<Ability>()
|
|
||||||
{
|
|
||||||
new Ability("Capacité 1", "image1.png", "Description de la capacité 1"),
|
|
||||||
new Ability("Capacité 2", "image2.png", "Description de la capacité 2")
|
|
||||||
};
|
|
||||||
|
|
||||||
// Act
|
|
||||||
var champion = new Champion(name, titre, image, abilities);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
Assert.Equal(name, champion.Name);
|
|
||||||
Assert.Equal(titre, champion.Titre);
|
|
||||||
Assert.Equal(image, champion.Image);
|
|
||||||
Assert.Equal(abilities, champion.Abilities);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Champion_ConstructorWithoutAbilities_SetsProperties()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
string name = "Champion 2";
|
|
||||||
string titre = "Titre du champion";
|
|
||||||
string image = "image2.png";
|
|
||||||
|
|
||||||
// Act
|
|
||||||
var champion = new Champion(name, titre, image);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
Assert.Equal(name, champion.Name);
|
|
||||||
Assert.Equal(titre, champion.Titre);
|
|
||||||
Assert.Equal(image, champion.Image);
|
|
||||||
Assert.Empty(champion.Abilities);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
using Moq;
|
|
||||||
using Models;
|
|
||||||
|
|
||||||
namespace Tests
|
|
||||||
{
|
|
||||||
public class IPersistanceManagerTests
|
|
||||||
{
|
|
||||||
[Fact]
|
|
||||||
public void ChargeDonne_ReturnsExpectedData()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
var mockPersistance = new Mock<IPersistanceManager>();
|
|
||||||
var expectedChampions = new List<Champion>
|
|
||||||
{
|
|
||||||
new Champion("Champion 1", "Titre 1", "Image 1"),
|
|
||||||
new Champion("Champion 2", "Titre 2", "Image 2"),
|
|
||||||
};
|
|
||||||
var expectedUtilisateurs = new List<Utilisateur>
|
|
||||||
{
|
|
||||||
new Utilisateur("Utilisateur 1"),
|
|
||||||
new Utilisateur("Utilisateur 2"),
|
|
||||||
};
|
|
||||||
mockPersistance.Setup(p => p.Chargdon())
|
|
||||||
.Returns((expectedChampions, expectedUtilisateurs));
|
|
||||||
var manager = new Manager(mockPersistance.Object);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
manager.Chargdon();
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
Assert.Equal(expectedChampions, manager._champions);
|
|
||||||
Assert.Equal(expectedUtilisateurs, manager._utilisateur);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Sauvdon_CallsPersistanceManagerSauvdonMethod()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
var mockPersistance = new Mock<IPersistanceManager>();
|
|
||||||
var manager = new Manager(mockPersistance.Object);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
manager.Sauvdon();
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
mockPersistance.Verify(p => p.Sauvdon(manager._champions, manager._utilisateur), Times.Once);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
using Models;
|
|
||||||
|
|
||||||
namespace Tests
|
|
||||||
{
|
|
||||||
public class StrategieTests
|
|
||||||
{
|
|
||||||
[Fact]
|
|
||||||
public void CreerStrategie_AvecNomDescriptionEtChampions_Valide()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
string nom = "Stratégie 1";
|
|
||||||
string description = "Description de la stratégie";
|
|
||||||
var champions = new List<Champion>
|
|
||||||
{
|
|
||||||
new Champion("Champion 1", "Titre 1", "Image 1"),
|
|
||||||
new Champion("Champion 2", "Titre 2", "Image 2")
|
|
||||||
new Champion("Champion 3", "Titre 3", "Image 3")
|
|
||||||
new Champion("Champion 4", "Titre 4", "Image 4")
|
|
||||||
new Champion("Champion 5", "Titre 5", "Image 5")
|
|
||||||
};
|
|
||||||
|
|
||||||
// Act
|
|
||||||
var strategie = new Strategie(nom, description, champions);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
Assert.Equal(nom, strategie.Name);
|
|
||||||
Assert.Equal(description, strategie.Description);
|
|
||||||
Assert.Equal(champions, strategie.Champions);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
using Xunit;
|
|
||||||
using Moq;
|
|
||||||
using Models;
|
|
||||||
|
|
||||||
namespace Tests
|
|
||||||
{
|
|
||||||
public class IPersistanceManagerTests
|
|
||||||
{
|
|
||||||
[Fact]
|
|
||||||
public void ChargeDonne_ReturnsExpectedData()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
var mockPersistance = new Mock<IPersistanceManager>();
|
|
||||||
var expectedChampions = new List<Champion>
|
|
||||||
{
|
|
||||||
new Champion("Champion 1", "Titre 1", "Image 1"),
|
|
||||||
new Champion("Champion 2", "Titre 2", "Image 2"),
|
|
||||||
};
|
|
||||||
var expectedUtilisateurs = new List<Utilisateur>
|
|
||||||
{
|
|
||||||
new Utilisateur("Utilisateur 1"),
|
|
||||||
new Utilisateur("Utilisateur 2"),
|
|
||||||
};
|
|
||||||
mockPersistance.Setup(p => p.Chargdon())
|
|
||||||
.Returns((expectedChampions, expectedUtilisateurs));
|
|
||||||
var manager = new Manager(mockPersistance.Object);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
manager.Chargdon();
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
Assert.Equal(expectedChampions, manager._champions);
|
|
||||||
Assert.Equal(expectedUtilisateurs, manager._utilisateur);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Sauvdon_CallsPersistanceManagerSauvdonMethod()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
var mockPersistance = new Mock<IPersistanceManager>();
|
|
||||||
var manager = new Manager(mockPersistance.Object);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
manager.Sauvdon();
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
mockPersistance.Verify(p => p.Sauvdon(manager._champions, manager._utilisateur), Times.Once);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
|
||||||
<IsTestProject>true</IsTestProject>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
|
|
||||||
<PackageReference Include="xunit" Version="2.4.2" />
|
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="coverlet.collector" Version="3.2.0">
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
</PackageReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\Models\Models.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@ -1 +0,0 @@
|
|||||||
global using Xunit;
|
|
Loading…
Reference in new issue