Commit 252c32e3 authored by Theresia Rupprecht's avatar Theresia Rupprecht
Browse files

Add: Unittests (coscine/issues#1203)

parent d9a423b8
param($installPath, $toolsPath, $package, $project)
# get the active solution
$solution = Get-Interface $dte.Solution ([EnvDTE80.Solution2])
$solutionPath = [System.IO.Path]::GetDirectoryName($solution.FullName)
$linq2dbToolsPath = [System.IO.Path]::Combine($solutionPath, ".tools", "linq2db.t4models")
# tools copy
xcopy $("$toolsPath\*.*") $("$linq2dbToolsPath\") /y /e
using Coscine.Api.Notices.Controllers;
using Coscine.Api.Notices.Services;
using Coscine.Logging;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using NUnit.Framework;
namespace Coscine.Api.Notice.Tests
{
public abstract class DefaultControllerTests<T> where T : Controller
{
protected T Controller { get; }
protected int Previous;
protected DefaultControllerTests(T controller)
{
Controller = controller;
}
[OneTimeSetUp]
public void Setup()
{
}
[OneTimeTearDown]
public void End()
{
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
<!-- optional, add some variables
https://github.com/nlog/NLog/wiki/Configuration-file#variables
-->
<variable name="myvar" value="myvalue"/>
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<targets>
<!--
add your targets here
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
-->
<!--
Write events to a file with the date in the filename.
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
-->
</targets>
<rules>
<!-- add your logging rules here -->
<!--
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
<logger name="*" minlevel="Debug" writeTo="f" />
-->
</rules>
</nlog>
This diff is collapsed.
using Coscine.Api.Notice.Tests;
using Coscine.Api.Notices.Controllers;
using Microsoft.AspNetCore.Mvc;
using NUnit.Framework;
namespace Coscine.Api.Notices.Tests
{
[TestFixture]
public class NoticeControllerTests : DefaultControllerTests<NoticeController>
{
public NoticeControllerTests() : base(new NoticeController(null))
{
}
[Test]
public void GetNoticeTest()
{
var invalidResult = Controller.GetNotice("abc", "en");
Assert.AreEqual(typeof(BadRequestResult), invalidResult.Result.GetType());
invalidResult = Controller.GetNotice("abc", "fn");
Assert.AreEqual(typeof(BadRequestResult), invalidResult.Result.GetType());
invalidResult = Controller.GetNotice("", "en");
Assert.AreEqual(typeof(BadRequestResult), invalidResult.Result.GetType());
invalidResult = Controller.GetNotice("", "");
Assert.AreEqual(typeof(BadRequestResult), invalidResult.Result.GetType());
invalidResult = Controller.GetNotice("changelog", "fn");
Assert.AreEqual(typeof(BadRequestResult), invalidResult.Result.GetType());
invalidResult = Controller.GetNotice("changelog", "");
Assert.AreEqual(typeof(BadRequestResult), invalidResult.Result.GetType());
var validResult = Controller.GetNotice("changelog", "en");
Assert.AreEqual(true, validResult.IsCompleted);
validResult = Controller.GetNotice("changelog", "de");
Assert.AreEqual(true, validResult.IsCompleted);
}
}
}
\ No newline at end of file
This diff is collapsed.
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Notices.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Notices.Tests")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6e5a8575-2400-49e7-bf02-1951e2e9e09a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Coscine.Database.T4" publicKeyToken="84b4c404a0696261" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.27.0.0" newVersion="1.27.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="linq2db" publicKeyToken="e41013125f9e410a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.1.1.0" newVersion="3.1.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Routing" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.2.0" newVersion="2.2.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.1.5.0" newVersion="3.1.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.1.5.0" newVersion="3.1.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Server.IIS" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.2.0" newVersion="2.2.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Server.IISIntegration" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.1.0" newVersion="2.2.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Options" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Tokens" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.7.1.0" newVersion="6.7.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IdentityModel.Tokens.Jwt" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.7.1.0" newVersion="6.7.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Principal.Windows" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.1" newVersion="4.1.1.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.1" newVersion="4.0.3.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Http" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.2.0" newVersion="2.2.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Mvc.Core" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.2.0" newVersion="2.2.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.ComponentModel.Annotations" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.3.0" newVersion="1.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.4.3.0" newVersion="1.4.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.1.0" newVersion="2.2.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.Cng" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.Binder" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.1.5.0" newVersion="3.1.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.FileProviders.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Logging" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.7.1.0" newVersion="6.7.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Http.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Hosting.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Hosting.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Http.Features" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Routing.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Mvc.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Mvc.ApiExplorer" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.StaticFiles" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Authorization" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Mvc.Formatters.Json" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="4.4.0" targetFramework="net461" />
<package id="Consul" version="0.7.2.6" targetFramework="net461" />
<package id="Coscine.ApiCommons" version="1.11.0" targetFramework="net461" />
<package id="Coscine.Configuration" version="1.5.0" targetFramework="net461" />
<package id="Coscine.Database" version="1.27.0" targetFramework="net461" />
<package id="Coscine.JwtHandler" version="1.2.0" targetFramework="net461" />
<package id="Coscine.Logging" version="1.2.0" targetFramework="net461" />
<package id="EntityFramework" version="6.4.4" targetFramework="net461" />
<package id="linq2db" version="3.1.1" targetFramework="net461" />
<package id="LinqKit" version="1.1.17" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Antiforgery" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Authentication" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Authentication.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Authentication.Core" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Authentication.JwtBearer" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Authorization" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Authorization.Policy" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Connections.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Cors" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Cryptography.Internal" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.DataProtection" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.DataProtection.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Diagnostics" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Diagnostics.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Hosting" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Hosting.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Hosting.Server.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Html.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Http" version="2.2.2" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Http.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Http.Extensions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Http.Features" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.HttpOverrides" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.JsonPatch" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Localization" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Mvc" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Mvc.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Mvc.Analyzers" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Mvc.ApiExplorer" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Mvc.Core" version="2.2.2" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Mvc.Cors" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Mvc.DataAnnotations" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Mvc.Formatters.Json" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Mvc.Localization" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Mvc.Razor" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Mvc.Razor.Extensions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Mvc.RazorPages" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Mvc.TagHelpers" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Mvc.ViewFeatures" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Razor" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Razor.Design" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Razor.Language" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Razor.Runtime" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.ResponseCaching.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Routing" version="2.2.2" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Routing.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Server.Kestrel" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Server.Kestrel.Core" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Server.Kestrel.Https" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" version="2.2.1" targetFramework="net461" />
<package id="Microsoft.AspNetCore.StaticFiles" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.WebUtilities" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.CodeAnalysis.Analyzers" version="2.9.2" targetFramework="net461" />
<package id="Microsoft.CodeAnalysis.Common" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.CodeAnalysis.CSharp" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.CodeAnalysis.Razor" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.CSharp" version="4.5.0" targetFramework="net461" />
<package id="Microsoft.DiaSymReader.Native" version="1.7.0" targetFramework="net461" />
<package id="Microsoft.DotNet.PlatformAbstractions" version="2.1.0" targetFramework="net461" />
<package id="Microsoft.Extensions.ApiDescription.Server" version="3.0.0" targetFramework="net461" developmentDependency="true" />
<package id="Microsoft.Extensions.Caching.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Caching.Memory" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.Binder" version="2.2.4" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.EnvironmentVariables" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.FileExtensions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.DependencyInjection" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.DependencyModel" version="2.1.0" targetFramework="net461" />
<package id="Microsoft.Extensions.FileProviders.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.FileProviders.Composite" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.FileProviders.Embedded" version="1.0.1" targetFramework="net461" />
<package id="Microsoft.Extensions.FileProviders.Physical" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.FileSystemGlobbing" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Hosting.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Localization" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Localization.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Logging" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.ObjectPool" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Options" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Primitives" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.WebEncoders" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.IdentityModel.JsonWebTokens" version="6.7.1" targetFramework="net461" />
<package id="Microsoft.IdentityModel.Logging" version="6.7.1" targetFramework="net461" />
<package id="Microsoft.IdentityModel.Protocols" version="5.3.0" targetFramework="net461" />
<package id="Microsoft.IdentityModel.Protocols.OpenIdConnect" version="5.3.0" targetFramework="net461" />
<package id="Microsoft.IdentityModel.Tokens" version="6.7.1" targetFramework="net461" />
<package id="Microsoft.Net.Http.Headers" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Win32.Registry" version="4.5.0" targetFramework="net461" />
<package id="Moq" version="4.13.1" targetFramework="net461" />
<package id="Namotion.Reflection" version="1.0.11" targetFramework="net461" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
<package id="Newtonsoft.Json.Bson" version="1.0.2" targetFramework="net461" />
<package id="NJsonSchema" version="10.1.23" targetFramework="net461" />
<package id="NLog" version="4.6.8" targetFramework="net461" />
<package id="NLog.Config" version="4.6.8" targetFramework="net461" />
<package id="NLog.Extensions.Logging" version="1.6.1" targetFramework="net461" />
<package id="NLog.Schema" version="4.6.8" targetFramework="net461" />
<package id="NLog.Web.AspNetCore" version="4.9.0" targetFramework="net461" />
<package id="NSwag.Annotations" version="13.6.2" targetFramework="net461" />
<package id="NSwag.AspNetCore" version="13.6.2" targetFramework="net461" />
<package id="NSwag.Core" version="13.6.2" targetFramework="net461" />
<package id="NSwag.Generation" version="13.6.2" targetFramework="net461" />
<package id="NSwag.Generation.AspNetCore" version="13.6.2" targetFramework="net461" />
<package id="NUnit" version="3.12.0" targetFramework="net461" />
<package id="System.AppContext" version="4.3.0" targetFramework="net461" />
<package id="System.Buffers" version="4.5.0" targetFramework="net461" />
<package id="System.Collections" version="4.3.0" targetFramework="net461" />
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="net461" />
<package id="System.ComponentModel.Annotations" version="4.5.0" targetFramework="net461" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net461" />
<package id="System.Diagnostics.DiagnosticSource" version="4.5.1" targetFramework="net461" />
<package id="System.Diagnostics.StackTrace" version="4.3.0" targetFramework="net461" />
<package id="System.Dynamic.Runtime" version="4.3.0" targetFramework="net461" />
<package id="System.IdentityModel.Tokens.Jwt" version="6.7.1" targetFramework="net461" />
<package id="System.IO" version="4.3.0" targetFramework="net461" />
<package id="System.IO.FileSystem" version="4.3.0" targetFramework="net461" />
<package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net461" />
<package id="System.IO.Pipelines" version="4.5.3" targetFramework="net461" />
<package id="System.Linq" version="4.3.0" targetFramework="net461" />
<package id="System.Memory" version="4.5.2" targetFramework="net461" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
<package id="System.Reflection.Metadata" version="1.6.0" targetFramework="net461" />
<package id="System.Runtime" version="4.3.1" targetFramework="net461" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net461" />
<package id="System.Runtime.Extensions" version="4.3.1" targetFramework="net461" />
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" />
<package id="System.Security.AccessControl" version="4.5.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.1" targetFramework="net461" />
<package id="System.Security.Cryptography.Cng" version="4.5.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.2" targetFramework="net461" />
<package id="System.Security.Cryptography.Xml" version="4.5.0" targetFramework="net461" />
<package id="System.Security.Permissions" version="4.5.0" targetFramework="net461" />
<package id="System.Security.Principal.Windows" version="4.5.1" targetFramework="net461" />
<package id="System.Text.Encoding.CodePages" version="4.5.1" targetFramework="net461" />
<package id="System.Text.Encodings.Web" version="4.5.0" targetFramework="net461" />
<package id="System.Threading.Tasks.Extensions" version="4.5.2" targetFramework="net461" />
<package id="System.Threading.Thread" version="4.3.0" targetFramework="net461" />
<package id="System.Xml.ReaderWriter" version="4.3.1" targetFramework="net461" />
<package id="System.Xml.XmlDocument" version="4.3.0" targetFramework="net461" />
</packages>
\ No newline at end of file
......@@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.29102.190
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Notices", "Notices\Notices.csproj", "{6AC6E1DD-AA80-4626-AF7D-EC6E73CE5B56}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Notices.Tests", "Notices.Tests\Notices.Tests.csproj", "{6E5A8575-2400-49E7-BF02-1951E2E9E09A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -15,6 +17,10 @@ Global
{6AC6E1DD-AA80-4626-AF7D-EC6E73CE5B56}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6AC6E1DD-AA80-4626-AF7D-EC6E73CE5B56}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6AC6E1DD-AA80-4626-AF7D-EC6E73CE5B56}.Release|Any CPU.Build.0 = Release|Any CPU
{6E5A8575-2400-49E7-BF02-1951E2E9E09A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6E5A8575-2400-49E7-BF02-1951E2E9E09A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6E5A8575-2400-49E7-BF02-1951E2E9E09A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6E5A8575-2400-49E7-BF02-1951E2E9E09A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -30,17 +30,19 @@ namespace Coscine.Api.Notices.Controllers
[ResponseCache(Duration = 60 * 60, VaryByQueryKeys = new[] { "documentSlug", "language" })]
public async Task<IActionResult> GetNotice(string documentSlug, [FromQuery] string language = "en")
{
var url = await Program.Configuration.GetStringAsync($"coscine/local/documents/{documentSlug}/{language}", null);
var url = Program.Configuration.GetStringAndWait($"coscine/local/documents/{documentSlug}/{language}", null);
if (url == null)
{
return BadRequest();
}
return Json(new {
data = new {
body = await _noticeService.GetNotice(url)
return Json(new