Skip to content

Commit

Permalink
Session10 - Pre-show (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
csharpfritz authored Nov 2, 2020
1 parent 5cd4b58 commit 6ea92cd
Show file tree
Hide file tree
Showing 10 changed files with 489 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*.user
*.userosscache
*.sln.docstates
*.swp

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down Expand Up @@ -350,4 +351,4 @@ MigrationBackup/
.ionide/

# ignore Jupyter notebook temp folder
.ipynb_checkpoints/
.ipynb_checkpoints/
48 changes: 48 additions & 0 deletions sessions/0110-UnitTests/0110-UnitTests.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Logic", "Logic\Logic.csproj", "{EC4507FE-091D-411F-A0A2-B28A9F5EEBE9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{C207CC72-59C4-4D09-82AC-9E6EBB844892}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EC4507FE-091D-411F-A0A2-B28A9F5EEBE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EC4507FE-091D-411F-A0A2-B28A9F5EEBE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EC4507FE-091D-411F-A0A2-B28A9F5EEBE9}.Debug|x64.ActiveCfg = Debug|Any CPU
{EC4507FE-091D-411F-A0A2-B28A9F5EEBE9}.Debug|x64.Build.0 = Debug|Any CPU
{EC4507FE-091D-411F-A0A2-B28A9F5EEBE9}.Debug|x86.ActiveCfg = Debug|Any CPU
{EC4507FE-091D-411F-A0A2-B28A9F5EEBE9}.Debug|x86.Build.0 = Debug|Any CPU
{EC4507FE-091D-411F-A0A2-B28A9F5EEBE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EC4507FE-091D-411F-A0A2-B28A9F5EEBE9}.Release|Any CPU.Build.0 = Release|Any CPU
{EC4507FE-091D-411F-A0A2-B28A9F5EEBE9}.Release|x64.ActiveCfg = Release|Any CPU
{EC4507FE-091D-411F-A0A2-B28A9F5EEBE9}.Release|x64.Build.0 = Release|Any CPU
{EC4507FE-091D-411F-A0A2-B28A9F5EEBE9}.Release|x86.ActiveCfg = Release|Any CPU
{EC4507FE-091D-411F-A0A2-B28A9F5EEBE9}.Release|x86.Build.0 = Release|Any CPU
{C207CC72-59C4-4D09-82AC-9E6EBB844892}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C207CC72-59C4-4D09-82AC-9E6EBB844892}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C207CC72-59C4-4D09-82AC-9E6EBB844892}.Debug|x64.ActiveCfg = Debug|Any CPU
{C207CC72-59C4-4D09-82AC-9E6EBB844892}.Debug|x64.Build.0 = Debug|Any CPU
{C207CC72-59C4-4D09-82AC-9E6EBB844892}.Debug|x86.ActiveCfg = Debug|Any CPU
{C207CC72-59C4-4D09-82AC-9E6EBB844892}.Debug|x86.Build.0 = Debug|Any CPU
{C207CC72-59C4-4D09-82AC-9E6EBB844892}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C207CC72-59C4-4D09-82AC-9E6EBB844892}.Release|Any CPU.Build.0 = Release|Any CPU
{C207CC72-59C4-4D09-82AC-9E6EBB844892}.Release|x64.ActiveCfg = Release|Any CPU
{C207CC72-59C4-4D09-82AC-9E6EBB844892}.Release|x64.Build.0 = Release|Any CPU
{C207CC72-59C4-4D09-82AC-9E6EBB844892}.Release|x86.ActiveCfg = Release|Any CPU
{C207CC72-59C4-4D09-82AC-9E6EBB844892}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
16 changes: 16 additions & 0 deletions sessions/0110-UnitTests/Logic/CouponEvaluator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace Logic
{
public class CouponEvaluator {

public void ApplyCoupon(Order order) {

// Save 10% with the SAVE10 coupon code
if (order.CouponCode == "SAVE10") {
order.CouponSavings = order.TotalCost * 0.1m;
}

}

}

}
7 changes: 7 additions & 0 deletions sessions/0110-UnitTests/Logic/Logic.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

</Project>
22 changes: 22 additions & 0 deletions sessions/0110-UnitTests/Logic/Order.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Collections.Generic;

namespace Logic
{

public class Order {

public int OrderId { get; set; }

public string CustomerName { get; set; }

public List<OrderItem> Items { get; set; }

public string CouponCode { get; set; }

public decimal CouponSavings { get; set; } = 0m;

public decimal TotalCost { get; set; }

}

}
17 changes: 17 additions & 0 deletions sessions/0110-UnitTests/Logic/OrderItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace Logic
{
public class OrderItem {

public int OrderId { get; set; }

public int OrderItemId { get; set; }

public Product Product { get; set; }

public int Quantity { get; set; }

public decimal TotalPrice { get; set; }

}

}
14 changes: 14 additions & 0 deletions sessions/0110-UnitTests/Logic/Product.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;

namespace Logic
{
public class Product
{
public int ProductId { get; set; }

public string Name { get; set; }

public decimal Price { get; set; }

}
}
Loading

0 comments on commit 6ea92cd

Please sign in to comment.