Skip to content

Commit 6654369

Browse files
authored
Merge pull request #22 from smartcodinghub/master
Añadir proyectos de ejemplo en C#
2 parents c27141c + 17a1d40 commit 6654369

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1599
-0
lines changed

examples/csharp/.gitignore

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
## Ignore Visual Studio temporary files, build results, and
2+
## files generated by popular Visual Studio add-ons.
3+
##
4+
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5+
6+
# User-specific files
7+
*.rsuser
8+
*.suo
9+
*.user
10+
*.userosscache
11+
*.sln.docstates
12+
13+
# User-specific files (MonoDevelop/Xamarin Studio)
14+
*.userprefs
15+
16+
# Mono auto generated files
17+
mono_crash.*
18+
19+
# Build results
20+
[Dd]ebug/
21+
[Dd]ebugPublic/
22+
[Rr]elease/
23+
[Rr]eleases/
24+
x64/
25+
x86/
26+
[Ww][Ii][Nn]32/
27+
[Aa][Rr][Mm]/
28+
[Aa][Rr][Mm]64/
29+
bld/
30+
[Bb]in/
31+
[Oo]bj/
32+
[Ll]og/
33+
[Ll]ogs/
34+
35+
# Visual Studio 2015/2017 cache/options directory
36+
.vs/
37+
# Uncomment if you have tasks that create the project's static files in wwwroot
38+
#wwwroot/
39+
40+
# Visual Studio 2017 auto generated files
41+
Generated\ Files/
42+
43+
# MSTest test Results
44+
[Tt]est[Rr]esult*/
45+
[Bb]uild[Ll]og.*
46+
47+
# NUnit
48+
*.VisualState.xml
49+
TestResult.xml
50+
nunit-*.xml
51+
52+
# Build Results of an ATL Project
53+
[Dd]ebugPS/
54+
[Rr]eleasePS/
55+
dlldata.c
56+
57+
# Benchmark Results
58+
BenchmarkDotNet.Artifacts/
59+
60+
# .NET Core
61+
project.lock.json
62+
project.fragment.lock.json
63+
artifacts/
64+
65+
# ASP.NET Scaffolding
66+
ScaffoldingReadMe.txt
67+
68+
# StyleCop
69+
StyleCopReport.xml
70+
71+
# Files built by Visual Studio
72+
*_i.c
73+
*_p.c
74+
*_h.h
75+
*.ilk
76+
*.meta
77+
*.obj
78+
*.iobj
79+
*.pch
80+
*.pdb
81+
*.ipdb
82+
*.pgc
83+
*.pgd
84+
*.rsp
85+
*.sbr
86+
*.tlb
87+
*.tli
88+
*.tlh
89+
*.tmp
90+
*.tmp_proj
91+
*_wpftmp.csproj
92+
*.log
93+
*.vspscc
94+
*.vssscc
95+
.builds
96+
*.pidb
97+
*.svclog
98+
*.scc
99+
100+
# Visual C++ cache files
101+
ipch/
102+
*.aps
103+
*.ncb
104+
*.opendb
105+
*.opensdf
106+
*.sdf
107+
*.cachefile
108+
*.VC.db
109+
*.VC.VC.opendb
110+
111+
# Visual Studio profiler
112+
*.psess
113+
*.vsp
114+
*.vspx
115+
*.sap
116+
117+
# Visual Studio Trace Files
118+
*.e2e
119+
120+
# ReSharper is a .NET coding add-in
121+
_ReSharper*/
122+
*.[Rr]e[Ss]harper
123+
*.DotSettings.user
124+
125+
# DotCover is a Code Coverage Tool
126+
*.dotCover
127+
128+
# Visual Studio code coverage results
129+
*.coverage
130+
*.coveragexml
131+
132+
# Web workbench (sass)
133+
.sass-cache/
134+
135+
# Click-Once directory
136+
publish/
137+
138+
# Publish Web Output
139+
*.[Pp]ublish.xml
140+
*.azurePubxml
141+
# Note: Comment the next line if you want to checkin your web deploy settings,
142+
# but database connection strings (with potential passwords) will be unencrypted
143+
*.pubxml
144+
*.publishproj
145+
146+
# Microsoft Azure Web App publish settings. Comment the next line if you want to
147+
# checkin your Azure Web App publish settings, but sensitive information contained
148+
# in these scripts will be unencrypted
149+
PublishScripts/
150+
151+
# NuGet Packages
152+
*.nupkg
153+
# NuGet Symbol Packages
154+
*.snupkg
155+
# The packages folder can be ignored because of Package Restore
156+
**/[Pp]ackages/*
157+
# except build/, which is used as an MSBuild target.
158+
!**/[Pp]ackages/build/
159+
# Uncomment if necessary however generally it will be regenerated when needed
160+
#!**/[Pp]ackages/repositories.config
161+
# NuGet v3's project.json files produces more ignorable files
162+
*.nuget.props
163+
*.nuget.targets
164+
165+
# Visual Studio cache files
166+
# files ending in .cache can be ignored
167+
*.[Cc]ache
168+
# but keep track of directories ending in .cache
169+
!?*.[Cc]ache/
170+
171+
# Others
172+
ClientBin/
173+
~$*
174+
*~
175+
*.dbmdl
176+
*.dbproj.schemaview
177+
*.jfm
178+
*.pfx
179+
*.publishsettings
180+
orleans.codegen.cs
181+
182+
# Backup & report files from converting an old project file
183+
# to a newer Visual Studio version. Backup files are not needed,
184+
# because we have git ;-)
185+
_UpgradeReport_Files/
186+
Backup*/
187+
UpgradeLog*.XML
188+
UpgradeLog*.htm
189+
ServiceFabricBackup/
190+
*.rptproj.bak
191+
192+
# SQL Server files
193+
*.mdf
194+
*.ldf
195+
*.ndf

examples/csharp/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
examples/csharp/create:
2+
3+
ifndef ExampleName
4+
$(error ExampleName is not set)
5+
endif
6+
7+
ifndef ContextName
8+
$(error ContextName is not set)
9+
endif
10+
11+
mkdir $(ExampleName)
12+
dotnet new sln -n $(ExampleName) -o "./$(ExampleName)"
13+
dotnet new classlib -n $(ContextName) -o "./$(ExampleName)/src/$(ContextName)" --framework net5.0
14+
dotnet sln "./$(ExampleName)/$(ExampleName).sln" add "./$(ExampleName)/src/$(ContextName)/$(ContextName).csproj" -s "src"
15+
dotnet new xunit -n "$(ContextName).Tests" -o "./$(ExampleName)/test/$(ContextName).Tests" --framework net5.0
16+
dotnet sln "./$(ExampleName)/$(ExampleName).sln" add "./$(ExampleName)/test/$(ContextName).Tests/$(ContextName).Tests.csproj" -s "test"
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.30626.31
5+
MinimumVisualStudioVersion = 15.0.26124.0
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Booking", "src\Booking\Booking.csproj", "{E268D5F9-53C4-4AFE-8726-A69B0405E97C}"
7+
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Booking.Tests", "test\Booking.Tests\Booking.Tests.csproj", "{5401F189-E054-490C-A525-8ADC69FC6717}"
9+
EndProject
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2081C16F-3A69-43B6-A2EC-B2DC50FB5AEF}"
11+
EndProject
12+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{A10B43E7-C43C-4A18-9DD6-5010B8530106}"
13+
EndProject
14+
Global
15+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
16+
Debug|Any CPU = Debug|Any CPU
17+
Debug|x64 = Debug|x64
18+
Debug|x86 = Debug|x86
19+
Release|Any CPU = Release|Any CPU
20+
Release|x64 = Release|x64
21+
Release|x86 = Release|x86
22+
EndGlobalSection
23+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
24+
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25+
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Debug|Any CPU.Build.0 = Debug|Any CPU
26+
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Debug|x64.ActiveCfg = Debug|Any CPU
27+
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Debug|x64.Build.0 = Debug|Any CPU
28+
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Debug|x86.ActiveCfg = Debug|Any CPU
29+
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Debug|x86.Build.0 = Debug|Any CPU
30+
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Release|Any CPU.ActiveCfg = Release|Any CPU
31+
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Release|Any CPU.Build.0 = Release|Any CPU
32+
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Release|x64.ActiveCfg = Release|Any CPU
33+
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Release|x64.Build.0 = Release|Any CPU
34+
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Release|x86.ActiveCfg = Release|Any CPU
35+
{E268D5F9-53C4-4AFE-8726-A69B0405E97C}.Release|x86.Build.0 = Release|Any CPU
36+
{5401F189-E054-490C-A525-8ADC69FC6717}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37+
{5401F189-E054-490C-A525-8ADC69FC6717}.Debug|Any CPU.Build.0 = Debug|Any CPU
38+
{5401F189-E054-490C-A525-8ADC69FC6717}.Debug|x64.ActiveCfg = Debug|Any CPU
39+
{5401F189-E054-490C-A525-8ADC69FC6717}.Debug|x64.Build.0 = Debug|Any CPU
40+
{5401F189-E054-490C-A525-8ADC69FC6717}.Debug|x86.ActiveCfg = Debug|Any CPU
41+
{5401F189-E054-490C-A525-8ADC69FC6717}.Debug|x86.Build.0 = Debug|Any CPU
42+
{5401F189-E054-490C-A525-8ADC69FC6717}.Release|Any CPU.ActiveCfg = Release|Any CPU
43+
{5401F189-E054-490C-A525-8ADC69FC6717}.Release|Any CPU.Build.0 = Release|Any CPU
44+
{5401F189-E054-490C-A525-8ADC69FC6717}.Release|x64.ActiveCfg = Release|Any CPU
45+
{5401F189-E054-490C-A525-8ADC69FC6717}.Release|x64.Build.0 = Release|Any CPU
46+
{5401F189-E054-490C-A525-8ADC69FC6717}.Release|x86.ActiveCfg = Release|Any CPU
47+
{5401F189-E054-490C-A525-8ADC69FC6717}.Release|x86.Build.0 = Release|Any CPU
48+
EndGlobalSection
49+
GlobalSection(SolutionProperties) = preSolution
50+
HideSolutionNode = FALSE
51+
EndGlobalSection
52+
GlobalSection(NestedProjects) = preSolution
53+
{E268D5F9-53C4-4AFE-8726-A69B0405E97C} = {2081C16F-3A69-43B6-A2EC-B2DC50FB5AEF}
54+
{5401F189-E054-490C-A525-8ADC69FC6717} = {A10B43E7-C43C-4A18-9DD6-5010B8530106}
55+
EndGlobalSection
56+
GlobalSection(ExtensibilityGlobals) = postSolution
57+
SolutionGuid = {A9B83075-4808-4A9E-8C77-26CC1263045F}
58+
EndGlobalSection
59+
EndGlobal
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using System;
2+
3+
namespace CodelyTv.Booking
4+
{
5+
public sealed class Booking
6+
{
7+
private readonly BookingId id;
8+
private readonly DateTime startDate;
9+
private readonly DateTime endDate;
10+
private readonly CustomerId customerId;
11+
private readonly CustomerName customerName;
12+
private readonly EmailAddress customerEmail;
13+
private readonly BookingType bookingType;
14+
private readonly DiscountType discountType;
15+
private readonly DiscountValue discountValue;
16+
private readonly TaxType taxType;
17+
private readonly TaxValue taxValue;
18+
19+
public Booking(
20+
BookingId id,
21+
DateTime startDate,
22+
DateTime endDate,
23+
CustomerId customerId,
24+
CustomerName customerName,
25+
EmailAddress customerEmail,
26+
BookingType bookingType,
27+
DiscountType discountType,
28+
DiscountValue discountValue,
29+
TaxType taxType,
30+
TaxValue taxValue
31+
)
32+
{
33+
this.id = id;
34+
this.startDate = startDate;
35+
this.endDate = endDate;
36+
this.customerId = customerId;
37+
this.customerName = customerName;
38+
this.customerEmail = customerEmail;
39+
this.bookingType = bookingType;
40+
this.discountType = discountType;
41+
this.discountValue = discountValue;
42+
this.taxType = taxType;
43+
this.taxValue = taxValue;
44+
}
45+
46+
public BookingStatus StatusFor(DateTime date)
47+
{
48+
if (date < startDate)
49+
{
50+
return BookingStatus.NOT_STARTED;
51+
}
52+
53+
if (date > startDate && date < endDate)
54+
{
55+
return BookingStatus.ACTIVE;
56+
}
57+
58+
return BookingStatus.FINISHED;
59+
}
60+
}
61+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net5.0</TargetFramework>
5+
<RootNamespace>CodelyTv.Booking</RootNamespace>
6+
</PropertyGroup>
7+
8+
</Project>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
3+
namespace CodelyTv.Booking
4+
{
5+
public sealed class BookingId
6+
{
7+
private readonly string value;
8+
9+
public BookingId(string value) => this.value = value;
10+
}
11+
12+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
namespace CodelyTv.Booking
2+
{
3+
public enum BookingStatus { NOT_STARTED, ACTIVE, FINISHED }
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
namespace CodelyTv.Booking
2+
{
3+
public enum BookingType { VACATION, WORK }
4+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace CodelyTv.Booking
2+
{
3+
public sealed class CustomerId
4+
{
5+
private readonly string value;
6+
7+
public CustomerId(string value) => this.value = value;
8+
}
9+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
3+
namespace CodelyTv.Booking
4+
{
5+
public sealed class CustomerName
6+
{
7+
private readonly string value;
8+
9+
public CustomerName(string value) => this.value = value;
10+
}
11+
12+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
namespace CodelyTv.Booking
2+
{
3+
public enum DiscountType { NONE }
4+
}

0 commit comments

Comments
 (0)