Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5221a57
Test
Martisca Jul 13, 2020
28ed70b
Schimbat cheie de conexiune
Martisca Jul 15, 2020
628eb90
Last Update by Trainer
Martisca Jul 17, 2020
a07b455
Unit Tests for AddCoffee and DeleteCoffee
Martisca Jul 17, 2020
63269cb
Correction
Martisca Jul 19, 2020
5e4c879
Second Correction
Martisca Jul 19, 2020
e3c3db1
Rename and CamelCase
Martisca Jul 19, 2020
744033b
Unit_Tests_Homework
adi9812 Jul 20, 2020
2a7455a
UnitTestsHomework_Refactoring
adi9812 Jul 20, 2020
511b85c
Added unit tests for remaining cases
balcanusebi Jul 20, 2020
001c82c
Added IEspressoMachineService
balcanusebi Jul 20, 2020
277a59c
Merge branch 'master' of https://github.com/balcanusebi/CoffeeMachine…
Martisca Jul 21, 2020
a52f410
Homework#2
Martisca Jul 21, 2020
240bdd1
HomeWork_2
adi9812 Jul 21, 2020
897b658
Homework#2 Correction
Martisca Jul 22, 2020
66518fd
Merge branch 'master' of https://github.com/adi9812/CoffeeMachineClass
adi9812 Jul 22, 2020
a04a734
Merge pull request #2 from Martisca/master
balcanusebi Jul 22, 2020
c524e26
Added ef core
balcanusebi Jul 22, 2020
bd0e174
Added new methods for tests
balcanusebi Jul 22, 2020
5db74a9
Merge branch 'master' of https://github.com/balcanusebi/CoffeeMachine…
balcanusebi Jul 22, 2020
78cf33a
Added EF
balcanusebi Jul 25, 2020
3e95ebf
Added CoffeeDataEntitiesTable
Martisca Jul 27, 2020
9335661
Merge pull request #7 from Martisca/EFconfigurationMartisca
balcanusebi Jul 27, 2020
487e85e
merge with master
balcanusebi Jul 27, 2020
6a37ba4
merge fixes
balcanusebi Jul 27, 2020
d580330
Merge pull request #8 from balcanusebi/Sebastian/EFconfiguration
balcanusebi Jul 27, 2020
98feba6
AddNewMethodsAndNewUnitTests
adi9812 Jul 29, 2020
67d91fe
Merge branch 'master' of https://github.com/adi9812/CoffeeMachineClass
adi9812 Jul 29, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ CoffeeMachineSimulator/CoffeeMachineSimulator.UI/obj
/CoffeeMachineSimulator/CoffeeMachineSimulator.Tests/bin/Debug/netcoreapp3.1
/CoffeeMachineSimulator/CoffeeMachineSimulator.Services/obj
/CoffeeMachineSimulator/CoffeeMachineSimulator.Services/bin/Debug/netcoreapp3.1
/CoffeeMachineSimulator/CoffeeMachineSimulator.Data/bin/Debug/netcoreapp3.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using CoffeeMachineSimulator.Data.Entities;
using Microsoft.EntityFrameworkCore;

namespace CoffeeMachineSimulator.Data
{
public class CoffeeContext : DbContext
{
public DbSet<CoffeeEntity> Coffees { get; set; }
public DbSet<EspressoMachineEntity> EspressoMachines { get; set; }
public DbSet<CoffeeDataEntity> CoffeeDataEntities { get; set; }

public CoffeeContext(DbContextOptions<CoffeeContext> options) : base(options)
{
}

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
ConfigureCoffeeModel(modelBuilder);
ConfigureEspressoMachineModel(modelBuilder);
ConfigureCoffeeDataModel(modelBuilder);
}

private static void ConfigureCoffeeModel(ModelBuilder modelBuilder)
{
var entity = modelBuilder.Entity<CoffeeEntity>();
entity.ToTable("Coffees");
entity.HasOne(x => x.EspressoMachine).WithMany();
}

private static void ConfigureEspressoMachineModel(ModelBuilder modelBuilder)
{
var entity = modelBuilder.Entity<EspressoMachineEntity>();
entity.ToTable("EspressoMachines");
}

private static void ConfigureCoffeeDataModel(ModelBuilder modelBuilder)
{
var entity = modelBuilder.Entity<CoffeeDataEntity>();
entity.ToTable("CoffeeDataEntities");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.6" />
</ItemGroup>

<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;

namespace CoffeeMachineSimulator.Data.Entities
{
public class BaseEntity
{
public Guid Id { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;

namespace CoffeeMachineSimulator.Data.Entities
{
public class CoffeeDataEntity : BaseEntity
{
public string City { get; set; }
public string SerialNumber { get; set; }
public string SensorType { get; set; }
public int SensorValue { get; set; }
public DateTime RecordingTime { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using CoffeeMachineSimulator.Data.Enums;
using System;

namespace CoffeeMachineSimulator.Data.Entities
{
public class CoffeeEntity : BaseEntity
{
public string Name { get; set; }
public float Price { get; set; }
public Sweetness Sweetness { get; set; }
public EspressoMachineEntity EspressoMachine { get; set; }
public Guid EspressoMachineId { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace CoffeeMachineSimulator.Data.Entities
{
public class EspressoMachineEntity : BaseEntity
{
public string Name { get; set; }
public bool IsEspressor { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace CoffeeMachineSimulator.Data.Enums
{
public enum Sweetness
{
Sweet,
LessSweet,
Bitter
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace CoffeeMachineSimulator.Data.Migrations
{
public partial class initialMigration : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Coffees",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
Name = table.Column<string>(nullable: true),
Price = table.Column<float>(nullable: false),
Sweetness = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Coffees", x => x.Id);
});
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Coffees");
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace CoffeeMachineSimulator.Data.Migrations
{
public partial class AddEspressoMachineTable : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "EspressoMachines",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
Name = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_EspressoMachines", x => x.Id);
});
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EspressoMachines");
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading