Skip to content

Commit 4f35f93

Browse files
committed
Testing AspNet Core with demo.
1 parent 038182b commit 4f35f93

26 files changed

+1845
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using Abp.Application.Services;
2+
3+
namespace AbpAspNetCoreDemo.Core.Application
4+
{
5+
public class DemoAppServiceBase : ApplicationService
6+
{
7+
public DemoAppServiceBase()
8+
{
9+
LocalizationSourceName = "AbpAspNetCoreDemoModule";
10+
}
11+
}
12+
}

test/aspnet-core-demo/AbpAspNetCoreDemo.Core/Application/ProductAppService.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ public ProductAppService(IRepository<Product> productRepository)
1717
_productRepository = productRepository;
1818
}
1919

20-
public virtual List<ProductDto> GetAll()
20+
public List<ProductDto> GetAll()
2121
{
2222
return _productRepository.GetAll().ToList().MapTo<List<ProductDto>>();
2323
}
2424

25-
public virtual int CreateProduct(ProductCreateInput input)
25+
public int CreateProduct(ProductCreateInput input)
2626
{
2727
return _productRepository.InsertAndGetId(ObjectMapper.Map<Product>(input));
2828
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using System;
2+
using Abp.Application.Features;
3+
using Abp.Authorization;
4+
using Abp.UI;
5+
using AbpAspNetCoreDemo.Core.Application.Dtos;
6+
7+
namespace AbpAspNetCoreDemo.Core.Application
8+
{
9+
public class TestAppService : DemoAppServiceBase
10+
{
11+
public string Test1()
12+
{
13+
return "FortyTwo";
14+
}
15+
16+
public ProductDto Test2()
17+
{
18+
return new ProductDto()
19+
{
20+
Id = 42,
21+
Name = "My product 1",
22+
Price = 99.9f
23+
};
24+
}
25+
26+
public ProductDto Test3()
27+
{
28+
throw new Exception("This should be gone as internal server error!");
29+
}
30+
31+
public ProductDto Test4()
32+
{
33+
throw new UserFriendlyException("Please don't call this method or you get the exception!");
34+
}
35+
36+
[AbpAuthorize()]
37+
public ProductDto Test5()
38+
{
39+
return null;
40+
}
41+
42+
[AbpAuthorize("MyTestPermissionName")]
43+
public ProductDto Test6()
44+
{
45+
return null;
46+
}
47+
48+
[RequiresFeature("MyTestFeatureName")]
49+
public ProductDto Test7()
50+
{
51+
return null;
52+
}
53+
}
54+
}

test/aspnet-core-demo/AbpAspNetCoreDemo/Views/Shared/_Layout.cshtml

+9
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,23 @@
5454
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js"
5555
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
5656
asp-fallback-test="window.jQuery">
57+
58+
5759
</script>
5860
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/bootstrap.min.js"
5961
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
6062
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal">
63+
64+
6165
</script>
6266
<script src="~/js/site.min.js" asp-append-version="true"></script>
6367
</environment>
6468

69+
<script src="~/Abp/Framework/scripts/abp.js" type="text/javascript"></script>
70+
<script src="~/Abp/Framework/scripts/libs/abp.jquery.js" type="text/javascript"></script>
71+
<script src="~/AbpScripts/GetScripts" type="text/javascript"></script>
72+
<script src="~/AbpServiceProxies/GetAll?type=jquery" type="text/javascript"></script>
73+
6574
@RenderSection("scripts", required: false)
6675
</body>
6776
</html>

0 commit comments

Comments
 (0)