Skip to content

Commit e38a82b

Browse files
committed
styling changes
1 parent 670bb47 commit e38a82b

File tree

9 files changed

+38
-61
lines changed

9 files changed

+38
-61
lines changed

DDDScot.sln

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E2EE7155-DAB
2323
EndProject
2424
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{44C1DD68-1371-456C-9541-BCC3CEE8A2BE}"
2525
EndProject
26-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "1. Tradtional Project Tests", "1. Tradtional Project Tests", "{DD7F5385-6594-4AF5-ADE9-ABC65C2A29BC}"
26+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "1. Traditional Project Tests", "1. Traditional Project Tests", "{DD7F5385-6594-4AF5-ADE9-ABC65C2A29BC}"
2727
EndProject
28-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TradtionalWebAPI.Tests", "TradtionalWebAPI.Tests\TradtionalWebAPI.Tests.csproj", "{2974A21D-76F8-4248-BF01-E7B5BDA6A6FF}"
28+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TraditionalWebAPI.Tests", "TraditionalWebAPI.Tests\TraditionalWebAPI.Tests.csproj", "{2974A21D-76F8-4248-BF01-E7B5BDA6A6FF}"
2929
EndProject
3030
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "2. MediatR Project Tests", "2. MediatR Project Tests", "{694570A7-D60F-4058-A86F-B146204891B7}"
3131
EndProject

FunctionalProject/Features/FuncFilms/FilmsModule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private async Task GetFilms(HttpContext context)
8282

8383
private async Task GetFilmById(HttpContext context)
8484
{
85-
var handler = RouteHandlers.ListFilmBIdHandler;
85+
var handler = RouteHandlers.ListFilmByIdHandler;
8686

8787
var film = handler(context.GetRouteData().As<int>("id"));
8888

FunctionalProject/Features/FuncFilms/RouteHandlers.cs

Lines changed: 23 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -11,63 +11,41 @@
1111

1212
public static class RouteHandlers
1313
{
14-
private static Func<IEnumerable<Film>> listFilms;
14+
public static Func<IEnumerable<Film>> ListFilmsHandler;
1515

16-
private static Func<int, Film> listFilmById;
16+
public static Func<int, Film> ListFilmByIdHandler;
1717

18-
private static Action<int, Film> updateFilm;
18+
public static Action<int, Film> UpdateFilmHandler;
1919

20-
private static Action<Film> createFilm;
20+
public static Action<Film> CreateFilmHandler;
2121

22-
private static Action<int> deleteFilm;
22+
public static Action<int> DeleteFilmHandler;
2323

2424
//private static Func<int,Film> getFilmyById = i => new Film { Id = 1, Name = "Pulp Fiction", DirectorId = 1 };
2525

26-
public static Func<IEnumerable<Film>> ListFilmsHandler
26+
static RouteHandlers()
2727
{
28-
get => listFilms ?? ListFilmsRoute.Handle;
29-
set => listFilms = value;
30-
}
31-
32-
public static Func<int, Film> ListFilmBIdHandler
33-
{
34-
get => listFilmById ?? (filmId => ListFilmByIdRoute.Handle(
35-
filmId,
36-
//Write some SQL to get the film
37-
fId => new Film { Id = 1, Name = "Pulp Fiction", DirectorId = 1 },
38-
//Write some SQL to get the director
39-
dirId => new Director { Name = "Steven Spielberg" },
40-
//Write some SQL to get the cast
41-
fId => new[] { new CastMember { Name = "John Travolta" }, new CastMember { Name = "Samuel L Jackson" } }
42-
)
28+
ListFilmsHandler = () => ListFilmsRoute.Handle();
29+
30+
ListFilmByIdHandler = filmId => ListFilmByIdRoute.Handle(filmId,
31+
//Write some SQL to get the film
32+
fId => new Film { Id = 1, Name = "Pulp Fiction", DirectorId = 1 },
33+
//Write some SQL to get the director
34+
dirId => new Director { Name = "Steven Spielberg" },
35+
//Write some SQL to get the cast
36+
fId => new[] { new CastMember { Name = "John Travolta" }, new CastMember { Name = "Samuel L Jackson" } }
4337
);
4438

45-
set => listFilmById = value;
46-
}
47-
48-
public static Action<int, Film> UpdateFilmHandler
49-
{
50-
get => updateFilm ?? ((filmId, film) => UpdateFilmRoute.Handle(
51-
filmId,
52-
film,
53-
() => new Random().Next() % 2 == 0,
54-
fId => new Film { Id = 1, Name = "Pulp Fiction", DirectorId = 1 }
55-
)
39+
UpdateFilmHandler = (filmId, film) => UpdateFilmRoute.Handle(
40+
filmId,
41+
film,
42+
() => new Random().Next() % 2 == 0,
43+
fId => new Film { Id = 1, Name = "Pulp Fiction", DirectorId = 1 }
5644
);
45+
46+
CreateFilmHandler = film => CreateFilmRoute.Handle(film, () => new Random().Next() % 2 == 0);
5747

58-
set => updateFilm = value;
59-
}
60-
61-
public static Action<Film> CreateFilmHandler
62-
{
63-
get => createFilm ?? (film => CreateFilmRoute.Handle(film, () => new Random().Next() % 2 == 0));
64-
set => createFilm = value;
65-
}
66-
67-
public static Action<int> DeleteFilmHandler
68-
{
69-
get => deleteFilm ?? (id => DeleteFilmRoute.Handle(id, () => new Random().Next() % 2 == 0));
70-
set => deleteFilm = value;
48+
DeleteFilmHandler = id => DeleteFilmRoute.Handle(id, () => new Random().Next() % 2 == 0);
7149
}
7250
}
7351
}

FunctionalProject/Features/NamedDelegatesFilms/Films/Permissions/ValidUserQuery.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
{
33
using System;
44

5-
6-
75
public static class ValidUserQuery
86
{
97
public static bool Execute()

FunctionalProject/Features/NamedDelegatesFilms/Films/RouteHandlers.cs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@
1111

1212
public static class RouteHandlers
1313
{
14+
public static CreateFilmDelegate CreateFilmHandler;
15+
16+
public static ListFilmByIdDelegate ListFilmByIdHandler;
17+
18+
public static DeleteFilmDelegate DeleteFilmHandler;
19+
20+
public static ListFilmsDelegate ListFilmsHandler;
21+
22+
public static UpdateFilmDelegate UpdateFilmHandler;
23+
1424
static RouteHandlers()
1525
{
1626
CreateFilmHandler = film => CreateFilmRoute.Handle(film, () => ValidUserQuery.Execute());
@@ -28,18 +38,9 @@ static RouteHandlers()
2838

2939
UpdateFilmHandler = (id, film) => UpdateFilmRoute.Handle(
3040
id,
31-
film, () => ValidUserQuery.Execute(),
41+
film,
42+
() => ValidUserQuery.Execute(),
3243
filmId => ListFilmsByIdQuery.ListFilmsByIdQuery.Execute(filmId));
3344
}
34-
35-
public static CreateFilmDelegate CreateFilmHandler;
36-
37-
public static ListFilmByIdDelegate ListFilmByIdHandler;
38-
39-
public static DeleteFilmDelegate DeleteFilmHandler;
40-
41-
public static ListFilmsDelegate ListFilmsHandler;
42-
43-
public static UpdateFilmDelegate UpdateFilmHandler;
4445
}
4546
}

Slides.pptx

-356 KB
Binary file not shown.

TradtionalWebAPI.Tests/Controllers/FilmControllerTests.cs renamed to TraditionalWebAPI.Tests/Controllers/FilmControllerTests.cs

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)