Skip to content

Instantly share code, notes, and snippets.

View chsami's full-sized avatar

chsami chsami

View GitHub Profile
<div [@enterAnimation] (@enterAnimation.done)="animationEndCallback($event)">
</div>
import { Version } from '../package.json';
loadChildren : () => import('./lazy/lazy.module').then(m => m.LazyModule), // new dynamic import method
loadChildren: './lazy/lazy.module#LazyModule', // use this syntax for non-ivy or Angular 7 and below
const webpack = require("webpack");
module.exports = {
outputDir: '../wwwroot/dist',
publicPath: "/dist/",
filenameHashing: false,
configureWebpack: {
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
builder.UseMvc(routes =>
{
routes.MapRoute("apiDefault", "api/{*url}", new { controller = "Home", action = "ApiNotFound" });
routes.MapRoute("spa-routes", "{*anything}", new { controller = "Home", action = "Index" });
});
public class JsonStatusCodeMiddleWare
{
private readonly RequestDelegate _next;
public JsonStatusCodeMiddleWare(RequestDelegate next)
{
_next = next;
}
public async Task Invoke(HttpContext context)
{
if (context.Response.StatusCode == (int)HttpStatusCode.OK)
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "Mediris Recipe API", Version = "v1" });
c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
Description = "JWT Authorization header using the Bearer scheme. \r\n\r\n Enter 'Bearer' [space] and then your token in the text input below.\r\n\r\nExample: \"Bearer 12345abcdef\"",
Name = "Authorization",
In = ParameterLocation.Header,
Type = SecuritySchemeType.ApiKey,
Scheme = "Bearer"
[TestClass]
public abstract class BaseTest
{
public static ServiceProvider serviceProvider;
public IMyService _myService;
[AssemblyInitialize]
public static void SetUp(TestContext context)
{
IServiceCollection services = new ServiceCollection();
services.AddTransient<IMyService, MyService>();
[TestClass]
public class MyServiceTests : BaseTest
{
[TestMethod]
public void TestMethod()
{
var result = _myService.myMethod()
Assert.IsNotNull(result);
}
}