-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from smartcodinghub/master
Añadir proyectos de ejemplo en C#
- Loading branch information
Showing
74 changed files
with
1,599 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
## Ignore Visual Studio temporary files, build results, and | ||
## files generated by popular Visual Studio add-ons. | ||
## | ||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore | ||
|
||
# User-specific files | ||
*.rsuser | ||
*.suo | ||
*.user | ||
*.userosscache | ||
*.sln.docstates | ||
|
||
# User-specific files (MonoDevelop/Xamarin Studio) | ||
*.userprefs | ||
|
||
# Mono auto generated files | ||
mono_crash.* | ||
|
||
# Build results | ||
[Dd]ebug/ | ||
[Dd]ebugPublic/ | ||
[Rr]elease/ | ||
[Rr]eleases/ | ||
x64/ | ||
x86/ | ||
[Ww][Ii][Nn]32/ | ||
[Aa][Rr][Mm]/ | ||
[Aa][Rr][Mm]64/ | ||
bld/ | ||
[Bb]in/ | ||
[Oo]bj/ | ||
[Ll]og/ | ||
[Ll]ogs/ | ||
|
||
# Visual Studio 2015/2017 cache/options directory | ||
.vs/ | ||
# Uncomment if you have tasks that create the project's static files in wwwroot | ||
#wwwroot/ | ||
|
||
# Visual Studio 2017 auto generated files | ||
Generated\ Files/ | ||
|
||
# MSTest test Results | ||
[Tt]est[Rr]esult*/ | ||
[Bb]uild[Ll]og.* | ||
|
||
# NUnit | ||
*.VisualState.xml | ||
TestResult.xml | ||
nunit-*.xml | ||
|
||
# Build Results of an ATL Project | ||
[Dd]ebugPS/ | ||
[Rr]eleasePS/ | ||
dlldata.c | ||
|
||
# Benchmark Results | ||
BenchmarkDotNet.Artifacts/ | ||
|
||
# .NET Core | ||
project.lock.json | ||
project.fragment.lock.json | ||
artifacts/ | ||
|
||
# ASP.NET Scaffolding | ||
ScaffoldingReadMe.txt | ||
|
||
# StyleCop | ||
StyleCopReport.xml | ||
|
||
# Files built by Visual Studio | ||
*_i.c | ||
*_p.c | ||
*_h.h | ||
*.ilk | ||
*.meta | ||
*.obj | ||
*.iobj | ||
*.pch | ||
*.pdb | ||
*.ipdb | ||
*.pgc | ||
*.pgd | ||
*.rsp | ||
*.sbr | ||
*.tlb | ||
*.tli | ||
*.tlh | ||
*.tmp | ||
*.tmp_proj | ||
*_wpftmp.csproj | ||
*.log | ||
*.vspscc | ||
*.vssscc | ||
.builds | ||
*.pidb | ||
*.svclog | ||
*.scc | ||
|
||
# Visual C++ cache files | ||
ipch/ | ||
*.aps | ||
*.ncb | ||
*.opendb | ||
*.opensdf | ||
*.sdf | ||
*.cachefile | ||
*.VC.db | ||
*.VC.VC.opendb | ||
|
||
# Visual Studio profiler | ||
*.psess | ||
*.vsp | ||
*.vspx | ||
*.sap | ||
|
||
# Visual Studio Trace Files | ||
*.e2e | ||
|
||
# ReSharper is a .NET coding add-in | ||
_ReSharper*/ | ||
*.[Rr]e[Ss]harper | ||
*.DotSettings.user | ||
|
||
# DotCover is a Code Coverage Tool | ||
*.dotCover | ||
|
||
# Visual Studio code coverage results | ||
*.coverage | ||
*.coveragexml | ||
|
||
# Web workbench (sass) | ||
.sass-cache/ | ||
|
||
# Click-Once directory | ||
publish/ | ||
|
||
# Publish Web Output | ||
*.[Pp]ublish.xml | ||
*.azurePubxml | ||
# Note: Comment the next line if you want to checkin your web deploy settings, | ||
# but database connection strings (with potential passwords) will be unencrypted | ||
*.pubxml | ||
*.publishproj | ||
|
||
# Microsoft Azure Web App publish settings. Comment the next line if you want to | ||
# checkin your Azure Web App publish settings, but sensitive information contained | ||
# in these scripts will be unencrypted | ||
PublishScripts/ | ||
|
||
# NuGet Packages | ||
*.nupkg | ||
# NuGet Symbol Packages | ||
*.snupkg | ||
# The packages folder can be ignored because of Package Restore | ||
**/[Pp]ackages/* | ||
# except build/, which is used as an MSBuild target. | ||
!**/[Pp]ackages/build/ | ||
# Uncomment if necessary however generally it will be regenerated when needed | ||
#!**/[Pp]ackages/repositories.config | ||
# NuGet v3's project.json files produces more ignorable files | ||
*.nuget.props | ||
*.nuget.targets | ||
|
||
# Visual Studio cache files | ||
# files ending in .cache can be ignored | ||
*.[Cc]ache | ||
# but keep track of directories ending in .cache | ||
!?*.[Cc]ache/ | ||
|
||
# Others | ||
ClientBin/ | ||
~$* | ||
*~ | ||
*.dbmdl | ||
*.dbproj.schemaview | ||
*.jfm | ||
*.pfx | ||
*.publishsettings | ||
orleans.codegen.cs | ||
|
||
# Backup & report files from converting an old project file | ||
# to a newer Visual Studio version. Backup files are not needed, | ||
# because we have git ;-) | ||
_UpgradeReport_Files/ | ||
Backup*/ | ||
UpgradeLog*.XML | ||
UpgradeLog*.htm | ||
ServiceFabricBackup/ | ||
*.rptproj.bak | ||
|
||
# SQL Server files | ||
*.mdf | ||
*.ldf | ||
*.ndf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
examples/csharp/create: | ||
|
||
ifndef ExampleName | ||
$(error ExampleName is not set) | ||
endif | ||
|
||
ifndef ContextName | ||
$(error ContextName is not set) | ||
endif | ||
|
||
mkdir $(ExampleName) | ||
dotnet new sln -n $(ExampleName) -o "./$(ExampleName)" | ||
dotnet new classlib -n $(ContextName) -o "./$(ExampleName)/src/$(ContextName)" --framework net5.0 | ||
dotnet sln "./$(ExampleName)/$(ExampleName).sln" add "./$(ExampleName)/src/$(ContextName)/$(ContextName).csproj" -s "src" | ||
dotnet new xunit -n "$(ContextName).Tests" -o "./$(ExampleName)/test/$(ContextName).Tests" --framework net5.0 | ||
dotnet sln "./$(ExampleName)/$(ExampleName).sln" add "./$(ExampleName)/test/$(ContextName).Tests/$(ContextName).Tests.csproj" -s "test" |
59 changes: 59 additions & 0 deletions
59
examples/csharp/csharp-booking-01_base/csharp-booking-01_base.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.30626.31 | ||
MinimumVisualStudioVersion = 15.0.26124.0 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Booking", "src\Booking\Booking.csproj", "{E268D5F9-53C4-4AFE-8726-A69B0405E97C}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Booking.Tests", "test\Booking.Tests\Booking.Tests.csproj", "{5401F189-E054-490C-A525-8ADC69FC6717}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2081C16F-3A69-43B6-A2EC-B2DC50FB5AEF}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{A10B43E7-C43C-4A18-9DD6-5010B8530106}" | ||
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(ProjectConfigurationPlatforms) = postSolution | ||
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Debug|x64.Build.0 = Debug|Any CPU | ||
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Debug|x86.Build.0 = Debug|Any CPU | ||
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Release|x64.ActiveCfg = Release|Any CPU | ||
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Release|x64.Build.0 = Release|Any CPU | ||
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Release|x86.ActiveCfg = Release|Any CPU | ||
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Release|x86.Build.0 = Release|Any CPU | ||
{5401F189-E054-490C-A525-8ADC69FC6717}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{5401F189-E054-490C-A525-8ADC69FC6717}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{5401F189-E054-490C-A525-8ADC69FC6717}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
{5401F189-E054-490C-A525-8ADC69FC6717}.Debug|x64.Build.0 = Debug|Any CPU | ||
{5401F189-E054-490C-A525-8ADC69FC6717}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
{5401F189-E054-490C-A525-8ADC69FC6717}.Debug|x86.Build.0 = Debug|Any CPU | ||
{5401F189-E054-490C-A525-8ADC69FC6717}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{5401F189-E054-490C-A525-8ADC69FC6717}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{5401F189-E054-490C-A525-8ADC69FC6717}.Release|x64.ActiveCfg = Release|Any CPU | ||
{5401F189-E054-490C-A525-8ADC69FC6717}.Release|x64.Build.0 = Release|Any CPU | ||
{5401F189-E054-490C-A525-8ADC69FC6717}.Release|x86.ActiveCfg = Release|Any CPU | ||
{5401F189-E054-490C-A525-8ADC69FC6717}.Release|x86.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
{E268D5F9-53C4-4AFE-8726-A69B0405E97C} = {2081C16F-3A69-43B6-A2EC-B2DC50FB5AEF} | ||
{5401F189-E054-490C-A525-8ADC69FC6717} = {A10B43E7-C43C-4A18-9DD6-5010B8530106} | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {A9B83075-4808-4A9E-8C77-26CC1263045F} | ||
EndGlobalSection | ||
EndGlobal |
61 changes: 61 additions & 0 deletions
61
examples/csharp/csharp-booking-01_base/src/Booking/Booking.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using System; | ||
|
||
namespace CodelyTv.Booking | ||
{ | ||
public sealed class Booking | ||
{ | ||
private readonly BookingId id; | ||
private readonly DateTime startDate; | ||
private readonly DateTime endDate; | ||
private readonly CustomerId customerId; | ||
private readonly CustomerName customerName; | ||
private readonly EmailAddress customerEmail; | ||
private readonly BookingType bookingType; | ||
private readonly DiscountType discountType; | ||
private readonly DiscountValue discountValue; | ||
private readonly TaxType taxType; | ||
private readonly TaxValue taxValue; | ||
|
||
public Booking( | ||
BookingId id, | ||
DateTime startDate, | ||
DateTime endDate, | ||
CustomerId customerId, | ||
CustomerName customerName, | ||
EmailAddress customerEmail, | ||
BookingType bookingType, | ||
DiscountType discountType, | ||
DiscountValue discountValue, | ||
TaxType taxType, | ||
TaxValue taxValue | ||
) | ||
{ | ||
this.id = id; | ||
this.startDate = startDate; | ||
this.endDate = endDate; | ||
this.customerId = customerId; | ||
this.customerName = customerName; | ||
this.customerEmail = customerEmail; | ||
this.bookingType = bookingType; | ||
this.discountType = discountType; | ||
this.discountValue = discountValue; | ||
this.taxType = taxType; | ||
this.taxValue = taxValue; | ||
} | ||
|
||
public BookingStatus StatusFor(DateTime date) | ||
{ | ||
if (date < startDate) | ||
{ | ||
return BookingStatus.NOT_STARTED; | ||
} | ||
|
||
if (date > startDate && date < endDate) | ||
{ | ||
return BookingStatus.ACTIVE; | ||
} | ||
|
||
return BookingStatus.FINISHED; | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
examples/csharp/csharp-booking-01_base/src/Booking/Booking.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net5.0</TargetFramework> | ||
<RootNamespace>CodelyTv.Booking</RootNamespace> | ||
</PropertyGroup> | ||
|
||
</Project> |
12 changes: 12 additions & 0 deletions
12
examples/csharp/csharp-booking-01_base/src/Booking/BookingId.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
|
||
namespace CodelyTv.Booking | ||
{ | ||
public sealed class BookingId | ||
{ | ||
private readonly string value; | ||
|
||
public BookingId(string value) => this.value = value; | ||
} | ||
|
||
} |
4 changes: 4 additions & 0 deletions
4
examples/csharp/csharp-booking-01_base/src/Booking/BookingStatus.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace CodelyTv.Booking | ||
{ | ||
public enum BookingStatus { NOT_STARTED, ACTIVE, FINISHED } | ||
} |
4 changes: 4 additions & 0 deletions
4
examples/csharp/csharp-booking-01_base/src/Booking/BookingType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace CodelyTv.Booking | ||
{ | ||
public enum BookingType { VACATION, WORK } | ||
} |
9 changes: 9 additions & 0 deletions
9
examples/csharp/csharp-booking-01_base/src/Booking/CustomerId.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace CodelyTv.Booking | ||
{ | ||
public sealed class CustomerId | ||
{ | ||
private readonly string value; | ||
|
||
public CustomerId(string value) => this.value = value; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
examples/csharp/csharp-booking-01_base/src/Booking/CustomerName.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
|
||
namespace CodelyTv.Booking | ||
{ | ||
public sealed class CustomerName | ||
{ | ||
private readonly string value; | ||
|
||
public CustomerName(string value) => this.value = value; | ||
} | ||
|
||
} |
4 changes: 4 additions & 0 deletions
4
examples/csharp/csharp-booking-01_base/src/Booking/DiscountType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace CodelyTv.Booking | ||
{ | ||
public enum DiscountType { NONE } | ||
} |
Oops, something went wrong.