Compare commits

..

No commits in common. 'master' and 'Test' have entirely different histories.
master ... Test

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 432 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 428 KiB

@ -1,13 +1,5 @@
[![Build Status](https://codefirst.iut.uca.fr/api/badges/najlae.lambaraa/Dice_App/status.svg)](https://codefirst.iut.uca.fr/najlae.lambaraa/Dice_App) # Dice_App
[![Coverage](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Test&metric=coverage&token=af49ebbdf97d0038355e8c623e4aebe595a500e9)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Test)
[![Lines of Code](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Test&metric=ncloc&token=af49ebbdf97d0038355e8c623e4aebe595a500e9)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Test)
[![Vulnerabilities](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Test&metric=vulnerabilities&token=af49ebbdf97d0038355e8c623e4aebe595a500e9)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Test)
[![Duplicated Lines (%)](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Test&metric=duplicated_lines_density&token=af49ebbdf97d0038355e8c623e4aebe595a500e9)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Test)
[![Bugs](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Test&metric=bugs&token=af49ebbdf97d0038355e8c623e4aebe595a500e9)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Test)
[![Code Smells](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Test&metric=code_smells&token=af49ebbdf97d0038355e8c623e4aebe595a500e9)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Test)
[![Security Rating](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Test&metric=security_rating&token=af49ebbdf97d0038355e8c623e4aebe595a500e9)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Test)
[![Technical Debt](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Test&metric=sqale_index&token=af49ebbdf97d0038355e8c623e4aebe595a500e9)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Test)
# Dice App
Dice App est une application mobile de jeu dés simple laquelle vous pouvez jouer a vos jeux de société
# Un titre

@ -1,10 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

@ -1,2 +0,0 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");

@ -1,58 +1,14 @@
using Entities; using System;
using Model;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Data namespace Data
{ {
public class DBManager : IDataManager public class DBManager
{
public bool AddDice(Die addD)
{
bool resulta=false;
using (var context = new NumberDieDbContext())
{
NumberDieEntity entity = new NumberDieEntity
{ {
};
context.AddAsync(entity);
resulta = context.SaveChanges() == 1;
}
return resulta;
}
public void clear()
{
using (var context = new NumberDieDbContext())
{
context.RemoveRange(context.NumberDice);
context.SaveChanges();
}
}
public List<Die> GetDices()
{
throw new NotImplementedException();
}
public bool RemoveDice(Die removeD)
{
bool reslta = false;
using (var context = new NumberDieDbContext())
{
context.Remove(removeD);
reslta= context.SaveChanges() == 1;
}
return reslta;
}
} }

@ -7,7 +7,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Entities\Entities.csproj" />
<ProjectReference Include="..\Model\Model.csproj" /> <ProjectReference Include="..\Model\Model.csproj" />
</ItemGroup> </ItemGroup>

@ -15,7 +15,6 @@ namespace Data
if (addD != null) if (addD != null)
{ {
listDice.Add(addD); listDice.Add(addD);
return true; return true;
} }
return false; return false;
@ -33,6 +32,8 @@ namespace Data
public List<Die> GetDices() public List<Die> GetDices()
{ {
return listDice; return listDice;
} }
@ -40,8 +41,8 @@ namespace Data
{ {
if (removeD!=null) if (removeD!=null)
{ {
listDice.Remove(removeD);
return listDice.Remove(removeD); return true;
} }
return false; return false;

@ -1,18 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>

@ -1,46 +0,0 @@
// <auto-generated />
using Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Entities.Migrations
{
[DbContext(typeof(NumberDieDbContext))]
[Migration("20221023150750_monNomDeMigration")]
partial class monNomDeMigration
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "6.0.10");
modelBuilder.Entity("Entities.NumberDieEntity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Max")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Min")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("NumberDice");
});
#pragma warning restore 612, 618
}
}
}

@ -1,33 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Entities.Migrations
{
public partial class monNomDeMigration : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "NumberDice",
columns: table => new
{
Id = table.Column<long>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false),
Min = table.Column<string>(type: "TEXT", nullable: false),
Max = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_NumberDice", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "NumberDice");
}
}
}

@ -1,44 +0,0 @@
// <auto-generated />
using Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Entities.Migrations
{
[DbContext(typeof(NumberDieDbContext))]
partial class NumberDieDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "6.0.10");
modelBuilder.Entity("Entities.NumberDieEntity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Max")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Min")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("NumberDice");
});
#pragma warning restore 612, 618
}
}
}

@ -1,20 +0,0 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Entities
{
public class NumberDieDbContext:DbContext
{
public DbSet<NumberDieEntity> NumberDice { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder.UseSqlite($"Data Source=Dice_App.NumberDice.db");
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
}
}
}

@ -1,10 +0,0 @@
namespace Entities
{
public class NumberDieEntity
{
public long Id { get; set; }
public int Name { get; set; }
public int Min { get; set; }
public int Max { get; set; }
}
}

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 16
VisualStudioVersion = 17.3.32929.385 VisualStudioVersion = 16.0.31005.135
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Model", "Model\Model.csproj", "{2CC2AF2A-F6B6-44BF-A1C2-710575725F6B}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Model", "Model\Model.csproj", "{2CC2AF2A-F6B6-44BF-A1C2-710575725F6B}"
EndProject EndProject
@ -9,10 +9,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testeur", "Testeur\Testeur.
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Data", "Data\Data.csproj", "{A99FF3EF-45E2-4688-B5D0-84E69E0F0E8E}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Data", "Data\Data.csproj", "{A99FF3EF-45E2-4688-B5D0-84E69E0F0E8E}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Entities", "Entities\Entities.csproj", "{F0890B94-7F39-47F0-B085-1728FAF43EA3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "App", "App\App.csproj", "{FBC77BA2-6449-4338-A6E5-19B0ABE5A883}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -31,14 +27,6 @@ Global
{A99FF3EF-45E2-4688-B5D0-84E69E0F0E8E}.Debug|Any CPU.Build.0 = Debug|Any CPU {A99FF3EF-45E2-4688-B5D0-84E69E0F0E8E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A99FF3EF-45E2-4688-B5D0-84E69E0F0E8E}.Release|Any CPU.ActiveCfg = Release|Any CPU {A99FF3EF-45E2-4688-B5D0-84E69E0F0E8E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A99FF3EF-45E2-4688-B5D0-84E69E0F0E8E}.Release|Any CPU.Build.0 = Release|Any CPU {A99FF3EF-45E2-4688-B5D0-84E69E0F0E8E}.Release|Any CPU.Build.0 = Release|Any CPU
{F0890B94-7F39-47F0-B085-1728FAF43EA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F0890B94-7F39-47F0-B085-1728FAF43EA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F0890B94-7F39-47F0-B085-1728FAF43EA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F0890B94-7F39-47F0-B085-1728FAF43EA3}.Release|Any CPU.Build.0 = Release|Any CPU
{FBC77BA2-6449-4338-A6E5-19B0ABE5A883}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FBC77BA2-6449-4338-A6E5-19B0ABE5A883}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FBC77BA2-6449-4338-A6E5-19B0ABE5A883}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FBC77BA2-6449-4338-A6E5-19B0ABE5A883}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

@ -20,10 +20,10 @@ namespace Model
public bool AddDice(Die addD) public bool AddDice(Die addD)
{ {
if(dataManager!=null) if(addD!=null)
{ {
return dataManager.AddDice(addD); dataManager.AddDice(addD);
return true;
} }
return false; return false;
@ -31,10 +31,10 @@ namespace Model
} }
public bool RemoveDice(Die removeD) public bool RemoveDice(Die removeD)
{ {
if (dataManager != null) if (removeD != null)
{ {
dataManager.RemoveDice(removeD);
return dataManager.RemoveDice(removeD); return true;
} }
return false; return false;
} }

@ -17,8 +17,7 @@ namespace Testeur
Manager m = new Manager(new Stub()); Manager m = new Manager(new Stub());
NumberDie nd = new NumberDie("de1",1,6); NumberDie nd = new NumberDie("de1",1,6);
// Acct // Acct
//m.AddDice(nd); m.AddDice(nd);
m.dataManager.AddDice(nd);
//Assert //Assert
Assert.Equal("de1", nd.Name); Assert.Equal("de1", nd.Name);
@ -32,8 +31,7 @@ namespace Testeur
int n = m.GetDice().Count(); int n = m.GetDice().Count();
NumberDie nd = new NumberDie("de1", 2, 6); NumberDie nd = new NumberDie("de1", 2, 6);
// Acct // Acct
// m.RemoveDice(nd); m.RemoveDice(nd);
m.dataManager.RemoveDice(nd);
//Assert //Assert
Assert.NotEqual(n, m.GetDice().Count); Assert.NotEqual(n, m.GetDice().Count);
} }
@ -46,11 +44,8 @@ namespace Testeur
int n = m.GetDice().Count(); int n = m.GetDice().Count();
NumberDie nd = null; NumberDie nd = null;
Assert.False(m.AddDice(nd)); Assert.False(m.AddDice(nd));
Assert.False(m.RemoveDice(nd)); Assert.False(m.RemoveDice(nd));
} }
} }
} }

Loading…
Cancel
Save