Skip to content

Commit 317aa2a

Browse files
committed
[r] file-scoped namespace
1 parent 26ef62a commit 317aa2a

263 files changed

Lines changed: 11947 additions & 12210 deletions

File tree

Some content is hidden

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

src/SampleApps/SampleApp.Classic.Tests/Controllers/DefaultPageControllerTests.cs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,21 @@
33
using SampleApp.Classic.Controllers;
44
using Simplify.Web.Responses;
55

6-
namespace SampleApp.Classic.Tests.Controllers
6+
namespace SampleApp.Classic.Tests.Controllers;
7+
8+
[TestFixture]
9+
public class DefaultPageControllerTests
710
{
8-
[TestFixture]
9-
public class DefaultPageControllerTests
11+
[Test]
12+
public void Invoke_Default_MainContentSet()
1013
{
11-
[Test]
12-
public void Invoke_Default_MainContentSet()
13-
{
14-
// Assign
15-
var c = new Mock<DefaultController> { CallBase = true };
14+
// Assign
15+
var c = new Mock<DefaultController> { CallBase = true };
1616

17-
// Act
18-
var result = c.Object.Invoke();
17+
// Act
18+
var result = c.Object.Invoke();
1919

20-
// Assert
21-
Assert.AreEqual("Default", ((StaticTpl)result).TemplateFileName);
22-
}
20+
// Assert
21+
Assert.AreEqual("Default", ((StaticTpl)result).TemplateFileName);
2322
}
2423
}

src/SampleApps/SampleApp.Classic.Tests/Controllers/Shared/NavbarControllerTests.cs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,27 @@
44
using Simplify.Templates;
55
using Simplify.Web.Responses;
66

7-
namespace SampleApp.Classic.Tests.Controllers.Shared
7+
namespace SampleApp.Classic.Tests.Controllers.Shared;
8+
9+
[TestFixture]
10+
public class NavbarControllerTests
811
{
9-
[TestFixture]
10-
public class NavbarControllerTests
12+
[Test]
13+
public void Invoke_InlineTplNavbarDataDataReturned()
1114
{
12-
[Test]
13-
public void Invoke_InlineTplNavbarDataDataReturned()
14-
{
15-
// Assign
15+
// Assign
1616

17-
var c = new Mock<NavbarController> { CallBase = true };
17+
var c = new Mock<NavbarController> { CallBase = true };
1818

19-
c.Setup(x => x.TemplateFactory.Load(It.Is<string>(name => name == "Navbar"))).Returns(TemplateBuilder.FromString("Inline Data").Build);
19+
c.Setup(x => x.TemplateFactory.Load(It.Is<string>(name => name == "Navbar"))).Returns(TemplateBuilder.FromString("Inline Data").Build);
2020

21-
// Act
22-
var result = c.Object.Invoke() as InlineTpl;
21+
// Act
22+
var result = c.Object.Invoke() as InlineTpl;
2323

24-
// Assert
24+
// Assert
2525

26-
Assert.IsNotNull(result);
27-
Assert.AreEqual("Navbar", result.DataCollectorVariableName);
28-
Assert.AreEqual("Inline Data", result.Data);
29-
}
26+
Assert.IsNotNull(result);
27+
Assert.AreEqual("Navbar", result.DataCollectorVariableName);
28+
Assert.AreEqual("Inline Data", result.Data);
3029
}
3130
}

src/SampleApps/SampleApp.Classic/Controllers/Accounts/LoginController.cs

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,31 @@
1212
using Simplify.Web.Modules;
1313
using Simplify.Web.Responses;
1414

15-
namespace SampleApp.Classic.Controllers.Accounts
15+
namespace SampleApp.Classic.Controllers.Accounts;
16+
17+
[Post("login")]
18+
public class LoginController : LoggableController<LoginViewModel>
1619
{
17-
[Post("login")]
18-
public class LoginController : LoggableController<LoginViewModel>
20+
public override async Task<ControllerResponse> Invoke()
1921
{
20-
public override async Task<ControllerResponse> Invoke()
21-
{
22-
await ReadModelAsync();
22+
await ReadModelAsync();
2323

24-
Log("Login controller executed");
24+
Log("Login controller executed");
2525

26-
if (Model.Password == "1" && Model.UserName == "Foo")
26+
if (Model.Password == "1" && Model.UserName == "Foo")
27+
{
28+
var claims = new List<Claim>
2729
{
28-
var claims = new List<Claim>
29-
{
30-
new Claim(ClaimTypes.Name, Model.UserName)
31-
};
30+
new Claim(ClaimTypes.Name, Model.UserName)
31+
};
3232

33-
var id = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
33+
var id = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
3434

35-
await Context.Context.SignInAsync(new ClaimsPrincipal(id));
35+
await Context.Context.SignInAsync(new ClaimsPrincipal(id));
3636

37-
return new Redirect(RedirectionType.LoginReturnUrl);
38-
}
39-
40-
return new Tpl(GetView<LoginView>().Get(Model, GetView<MessageBoxView>().Get(StringTable.WrongUserNameOrPassword)), StringTable.PageTitleLogin);
37+
return new Redirect(RedirectionType.LoginReturnUrl);
4138
}
39+
40+
return new Tpl(GetView<LoginView>().Get(Model, GetView<MessageBoxView>().Get(StringTable.WrongUserNameOrPassword)), StringTable.PageTitleLogin);
4241
}
4342
}

src/SampleApps/SampleApp.Classic/Controllers/Accounts/LoginPageController.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
using Simplify.Web.Attributes;
44
using Simplify.Web.Responses;
55

6-
namespace SampleApp.Classic.Controllers.Accounts
6+
namespace SampleApp.Classic.Controllers.Accounts;
7+
8+
[Get("login")]
9+
public class LoginPageController : Controller
710
{
8-
[Get("login")]
9-
public class LoginPageController : Controller
11+
public override ControllerResponse Invoke()
1012
{
11-
public override ControllerResponse Invoke()
12-
{
13-
return new Tpl(GetView<LoginView>().Get(), StringTable.PageTitleLogin);
14-
}
13+
return new Tpl(GetView<LoginView>().Get(), StringTable.PageTitleLogin);
1514
}
1615
}

src/SampleApps/SampleApp.Classic/Controllers/Accounts/LogoutController.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44
using Simplify.Web.Attributes;
55
using Simplify.Web.Responses;
66

7-
namespace SampleApp.Classic.Controllers.Accounts
7+
namespace SampleApp.Classic.Controllers.Accounts;
8+
9+
[Get("logout")]
10+
public class LogoutController : AsyncController
811
{
9-
[Get("logout")]
10-
public class LogoutController : AsyncController
12+
public override async Task<ControllerResponse> Invoke()
1113
{
12-
public override async Task<ControllerResponse> Invoke()
13-
{
14-
await Context.Context.SignOutAsync();
14+
await Context.Context.SignOutAsync();
1515

16-
return new Redirect();
17-
}
16+
return new Redirect();
1817
}
1918
}

src/SampleApps/SampleApp.Classic/Controllers/DefaultController.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
using Simplify.Web.Attributes;
33
using Simplify.Web.Responses;
44

5-
namespace SampleApp.Classic.Controllers
5+
namespace SampleApp.Classic.Controllers;
6+
7+
[Get("/")]
8+
public class DefaultController : Controller
69
{
7-
[Get("/")]
8-
public class DefaultController : Controller
10+
public override ControllerResponse Invoke()
911
{
10-
public override ControllerResponse Invoke()
11-
{
12-
return new StaticTpl("Default");
13-
}
12+
return new StaticTpl("Default");
1413
}
1514
}

src/SampleApps/SampleApp.Classic/Controllers/ExceptionExampleController.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
using Simplify.Web;
33
using Simplify.Web.Attributes;
44

5-
namespace SampleApp.Classic.Controllers
5+
namespace SampleApp.Classic.Controllers;
6+
7+
[Get("exception")]
8+
public class ExceptionExampleController : Controller
69
{
7-
[Get("exception")]
8-
public class ExceptionExampleController : Controller
10+
public override ControllerResponse Invoke()
911
{
10-
public override ControllerResponse Invoke()
11-
{
12-
throw new NotImplementedException();
13-
}
12+
throw new NotImplementedException();
1413
}
1514
}

src/SampleApps/SampleApp.Classic/Controllers/Shared/LoginPanelController.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44
using Simplify.Web.Attributes;
55
using Simplify.Web.Responses;
66

7-
namespace SampleApp.Classic.Controllers.Shared
7+
namespace SampleApp.Classic.Controllers.Shared;
8+
9+
[Priority(-1)]
10+
public class LoginPanelController : AsyncController
811
{
9-
[Priority(-1)]
10-
public class LoginPanelController : AsyncController
12+
public override async Task<ControllerResponse> Invoke()
1113
{
12-
public override async Task<ControllerResponse> Invoke()
13-
{
14-
return !Context.IsAuthenticated
15-
? new InlineTpl("LoginPanel", await TemplateFactory.LoadAsync("Shared/LoginPanel/GuestPanel"))
16-
: new InlineTpl("LoginPanel", await GetView<LoggedUserPanelView>().Get(Context.Context.User.Identity.Name));
17-
}
14+
return !Context.IsAuthenticated
15+
? new InlineTpl("LoginPanel", await TemplateFactory.LoadAsync("Shared/LoginPanel/GuestPanel"))
16+
: new InlineTpl("LoginPanel", await GetView<LoggedUserPanelView>().Get(Context.Context.User.Identity.Name));
1817
}
1918
}

src/SampleApps/SampleApp.Classic/Controllers/Shared/NavbarController.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
using Simplify.Web.Attributes;
33
using Simplify.Web.Responses;
44

5-
namespace SampleApp.Classic.Controllers.Shared
5+
namespace SampleApp.Classic.Controllers.Shared;
6+
7+
[Priority(-2)]
8+
public class NavbarController : Controller
69
{
7-
[Priority(-2)]
8-
public class NavbarController : Controller
10+
public override ControllerResponse Invoke()
911
{
10-
public override ControllerResponse Invoke()
11-
{
12-
return new InlineTpl("Navbar", TemplateFactory.Load("Navbar"));
13-
}
12+
return new InlineTpl("Navbar", TemplateFactory.Load("Navbar"));
1413
}
1514
}

src/SampleApps/SampleApp.Classic/Controllers/Static/AboutController.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
using Simplify.Web.Attributes;
33
using Simplify.Web.Responses;
44

5-
namespace SampleApp.Classic.Controllers.Static
5+
namespace SampleApp.Classic.Controllers.Static;
6+
7+
[Get("about")]
8+
public class AboutController : Controller
69
{
7-
[Get("about")]
8-
public class AboutController : Controller
10+
public override ControllerResponse Invoke()
911
{
10-
public override ControllerResponse Invoke()
11-
{
12-
return new StaticTpl("Static/About", StringTable.PageTitleAbout);
13-
}
12+
return new StaticTpl("Static/About", StringTable.PageTitleAbout);
1413
}
1514
}

0 commit comments

Comments
 (0)