Skip to content

Commit

Permalink
Changed framework to 2.0.0 from 2.0.0-preview1 g0t4#3
Browse files Browse the repository at this point in the history
  • Loading branch information
g0t4 authored and derekg committed Jan 3, 2018
1 parent 2b0a665 commit 7112c3a
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 4 deletions.
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
**/bin/
**/obj/
**/.vs/
**/.git/
infra/
**/global.json
**/Dockerfile*
**/.dockerignore*
**/docker-compose*.yml
**/*.user
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# build stage
FROM microsoft/aspnetcore-build:2 as build-env

WORKDIR /generator

# restore
COPY api/api.csproj ./api/
RUN dotnet restore api/api.csproj
COPY tests/tests.csproj ./tests/
RUN dotnet restore tests/tests.csproj

# copy src
COPY . .

# test
RUN dotnet test tests/tests.csproj

# publish
RUN dotnet publish api/api.csproj -o /publish

# runtime stage
FROM microsoft/aspnetcore:2
COPY --from=build-env /publish /publish
WORKDIR /publish
ENTRYPOINT [ "dotnet", "api.dll"]
6 changes: 3 additions & 3 deletions api/api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
<ItemGroup>
<PackageReference Include="Faker.Net" Version="1.0.3" />
<PackageReference Include="MailKit" Version="1.16.1" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0-preview1-final" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0-preview1-final" />
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="2.0.0-preview1-final" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="2.0.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion api/global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "2.0.0-preview1-005977"
"version": "2.0.0"
}
}
13 changes: 13 additions & 0 deletions infra/registry/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3.1'

services:
my-registry:
image: registry:2.6.1
volumes:
- registry:/var/lib/registry
ports:
- "55000:5000"
restart: unless-stopped

volumes:
registry:
22 changes: 22 additions & 0 deletions infra/teamcity/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: '3.1'

services:
teamcity:
image: jetbrains/teamcity-server:2017.1.2
volumes:
- teamcity-server-datadir:/data/teamcity_server/datadir
- teamcity-server-logs:/opt/teamcity/logs
ports:
- 8111:8111
teamcity-agent:
image: jetbrains/teamcity-agent:2017.1.2
environment:
SERVER_URL: http://teamcity:8111
volumes:
- /var/run/docker.sock:/var/run/docker.sock


volumes:
teamcity-server-datadir:
teamcity-server-logs:

31 changes: 31 additions & 0 deletions tests/RangeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Linq;
using api.Controllers;
using Xunit;

namespace tests
{
public class RangeTests
{
[Fact]
public void CountShouldControlNumberOfResults()
{
var range = new Range { Count = 3 };

var generated = range.Of(() => "");

Assert.Equal(3, generated.Count());
}

[Fact]
public void SortShouldOrderResults()
{
var range = new Range { Count = 3, Sort = true };
var values = new[] { "a", "c", "b" };
var counter = 0;
var generated = range.Of(() => values[counter++]);

Assert.Equal(new[] { "a", "b", "c" }, generated.ToArray());
}
}
}
19 changes: 19 additions & 0 deletions tests/tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0-preview-20170628-02" />
<PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\api\api.csproj" />
</ItemGroup>

</Project>

0 comments on commit 7112c3a

Please sign in to comment.