testUnitaire

master
Baptiste ARNAUD 6 years ago
parent a6c44d2785
commit 3ebeda2925

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
</ItemGroup>
</Project>

@ -0,0 +1,18 @@
using NUnit.Framework;
namespace NUnitTestProject1
{
public class Tests
{
[SetUp]
public void Setup()
{
}
[Test]
public void Test1()
{
Assert.Pass();
}
}
}

@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
<PackageReference Include="coverlet.collector" Version="1.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TheGameExtreme.Android\TheGameExtreme.Android.csproj" />
<ProjectReference Include="..\TheGameExtreme.iOS\TheGameExtreme.iOS.csproj" />
<ProjectReference Include="..\TheGameExtreme\TheGameExtreme.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,11 @@
namespace TestUnit
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
}
}
}

@ -9,7 +9,7 @@ namespace TestUnitaire
{ {
public class AppInitializer public class AppInitializer
{ {
public static IApp StartApp(Platform platform) /*public static IApp StartApp(Platform platform)
{ {
// TODO: If the iOS or Android app being tested is included in the solution // TODO: If the iOS or Android app being tested is included in the solution
// then open the Unit Tests window, right click Test Apps, select Add App Project // then open the Unit Tests window, right click Test Apps, select Add App Project
@ -38,6 +38,6 @@ namespace TestUnitaire
// code if the app is not included in the solution. // code if the app is not included in the solution.
//.AppBundle ("../../../iOS/bin/iPhoneSimulator/Debug/XamarinForms.iOS.app") //.AppBundle ("../../../iOS/bin/iPhoneSimulator/Debug/XamarinForms.iOS.app")
.StartApp(); .StartApp();
} }*/
} }
} }

@ -1,11 +1,11 @@
#pragma warning disable 1591 #pragma warning disable 1591
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // Ce code a été généré par un outil.
// Runtime Version:4.0.30319.42000 // Version du runtime :4.0.30319.42000
// //
// Changes to this file may cause incorrect behavior and will be lost if // Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
// the code is regenerated. // le code est régénéré.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

@ -10,7 +10,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TheGameExtreme", "TheGameEx
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestUnitaire", "TestUnitaire\TestUnitaire.csproj", "{DAB0A3A0-CD99-4819-A813-01F10D77BAB1}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestUnitaire", "TestUnitaire\TestUnitaire.csproj", "{DAB0A3A0-CD99-4819-A813-01F10D77BAB1}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectUnitaire", "ProjectUnitaire\ProjectUnitaire.csproj", "{FA55654F-097D-4E83-809E-A2C7E46563A4}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestProjectGame", "UnitTestProjectGame\UnitTestProjectGame.csproj", "{4092C852-D253-42F7-A800-E618C99C349E}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -70,18 +70,18 @@ Global
{DAB0A3A0-CD99-4819-A813-01F10D77BAB1}.Release|iPhone.Build.0 = Release|Any CPU {DAB0A3A0-CD99-4819-A813-01F10D77BAB1}.Release|iPhone.Build.0 = Release|Any CPU
{DAB0A3A0-CD99-4819-A813-01F10D77BAB1}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {DAB0A3A0-CD99-4819-A813-01F10D77BAB1}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{DAB0A3A0-CD99-4819-A813-01F10D77BAB1}.Release|iPhoneSimulator.Build.0 = Release|Any CPU {DAB0A3A0-CD99-4819-A813-01F10D77BAB1}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{FA55654F-097D-4E83-809E-A2C7E46563A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4092C852-D253-42F7-A800-E618C99C349E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA55654F-097D-4E83-809E-A2C7E46563A4}.Debug|Any CPU.Build.0 = Debug|Any CPU {4092C852-D253-42F7-A800-E618C99C349E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA55654F-097D-4E83-809E-A2C7E46563A4}.Debug|iPhone.ActiveCfg = Debug|Any CPU {4092C852-D253-42F7-A800-E618C99C349E}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{FA55654F-097D-4E83-809E-A2C7E46563A4}.Debug|iPhone.Build.0 = Debug|Any CPU {4092C852-D253-42F7-A800-E618C99C349E}.Debug|iPhone.Build.0 = Debug|Any CPU
{FA55654F-097D-4E83-809E-A2C7E46563A4}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU {4092C852-D253-42F7-A800-E618C99C349E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{FA55654F-097D-4E83-809E-A2C7E46563A4}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {4092C852-D253-42F7-A800-E618C99C349E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{FA55654F-097D-4E83-809E-A2C7E46563A4}.Release|Any CPU.ActiveCfg = Release|Any CPU {4092C852-D253-42F7-A800-E618C99C349E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA55654F-097D-4E83-809E-A2C7E46563A4}.Release|Any CPU.Build.0 = Release|Any CPU {4092C852-D253-42F7-A800-E618C99C349E}.Release|Any CPU.Build.0 = Release|Any CPU
{FA55654F-097D-4E83-809E-A2C7E46563A4}.Release|iPhone.ActiveCfg = Release|Any CPU {4092C852-D253-42F7-A800-E618C99C349E}.Release|iPhone.ActiveCfg = Release|Any CPU
{FA55654F-097D-4E83-809E-A2C7E46563A4}.Release|iPhone.Build.0 = Release|Any CPU {4092C852-D253-42F7-A800-E618C99C349E}.Release|iPhone.Build.0 = Release|Any CPU
{FA55654F-097D-4E83-809E-A2C7E46563A4}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {4092C852-D253-42F7-A800-E618C99C349E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{FA55654F-097D-4E83-809E-A2C7E46563A4}.Release|iPhoneSimulator.Build.0 = Release|Any CPU {4092C852-D253-42F7-A800-E618C99C349E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

@ -17,7 +17,6 @@ namespace TheGameExtreme.model.manager
public override void endTurn() public override void endTurn()
{ {
// Vérifie que l'utilisateur a bien joué deux cartes // Vérifie que l'utilisateur a bien joué deux cartes
pioche(); pioche();
currentIndexPlayer += 1; currentIndexPlayer += 1;

@ -0,0 +1,20 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("UnitTestProjectGame")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UnitTestProjectGame")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("4092c852-d253-42f7-a800-e618c99c349e")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TheGameExtreme.model;
using TheGameExtreme.model.manager;
using TheGameExtreme.viewmodel;
namespace UnitTestProjectGame
{
[TestClass]
public class UnitTest1
{
GameManager g1 = new SoloGameManager(2, new List<String> { "clement", " baptiste" });
[TestMethod]
public void JoueTest()
{
object expectedRes = null;
int valueCard = 89;
int orderedStackSelected = 3;
g1.joue(valueCard, orderedStackSelected);
Assert.AreEqual(expectedRes, null);
}
[TestMethod]
public void isCanPlayTest()
{
List<Card> currentHhand = new List<Card>();
bool valeur;
bool expected1 = true;
bool expected2 = false;
g1.isCanPlay();
if(g1.isCanPlay() == true)
{
valeur = true;
Assert.AreEqual(expected1, valeur);
}
/*else
{
//Exception à gérer//
}*/
if(g1.isCanPlay() == false)
{
valeur = false;
Assert.Equals(expected2, valeur);
}
else
{
//Exception à gérer//
}
}
[TestMethod]
public void EndTurnTest()
{
object expectedRes = null;
g1.endTurn();
Assert.AreEqual(expectedRes, null);
}
[TestMethod]
public void getCurentIndexPlayerTest()
{
}
}
}

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4092C852-D253-42F7-A800-E618C99C349E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UnitTestProjectGame</RootNamespace>
<AssemblyName>UnitTestProjectGame</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="UnitTest1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TheGameExtreme\TheGameExtreme.csproj">
<Project>{8DE6C881-FF77-4CC4-B8C4-CDEDD9AB13B3}</Project>
<Name>TheGameExtreme</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Ce projet fait référence à des packages NuGet qui sont manquants sur cet ordinateur. Utilisez l'option de restauration des packages NuGet pour les télécharger. Pour plus d'informations, consultez http://go.microsoft.com/fwlink/?LinkID=322105. Le fichier manquant est : {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" />
</Project>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MSTest.TestAdapter" version="1.3.2" targetFramework="net472" />
<package id="MSTest.TestFramework" version="1.3.2" targetFramework="net472" />
</packages>

@ -0,0 +1,15 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TheGameExtreme.model.manager;
namespace UnitTestProjectTheGame
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
GameManager g1 = new SoloGameManager();
}
}
}

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
<PackageReference Include="coverlet.collector" Version="1.0.1" />
</ItemGroup>
</Project>

@ -0,0 +1 @@
module Program = let [<EntryPoint>] main _ = 0

@ -0,0 +1,11 @@
namespace UnitTestTheGame
open System
open Microsoft.VisualStudio.TestTools.UnitTesting
[<TestClass>]
type TestClass () =
[<TestMethod>]
member this.TestMethodPassing () =
Assert.IsTrue(true);

@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<IsPackable>false</IsPackable>
<GenerateProgramFile>false</GenerateProgramFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="Tests.fs" />
<Compile Include="Program.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
<PackageReference Include="coverlet.collector" Version="1.0.1" />
</ItemGroup>
</Project>
Loading…
Cancel
Save