Skip to content

Instantly share code, notes, and snippets.

View iqan's full-sized avatar
🎯
Focusing

Iqan Shaikh iqan

🎯
Focusing
View GitHub Profile
[Unit]
Description=Dummy Service in .NET
# Requires=xyz.service
# After=xyz.service
[Service]
Type=forking
WorkingDirectory=/user/iqan
ExecStart=dotnet DummyService/bin/debug/DummyService.dll
version: '3.4'
services:
dummyservice.app:
image: iqan/dummyserviceapp
build:
context: .
dockerfile: DummyService.App/Dockerfile
environment:
- EndpointConfiguration:ConnectionString=<your-servicebus-connectionstring>
FROM microsoft/dotnet:2.1-runtime-stretch-slim AS base
WORKDIR /app
FROM microsoft/dotnet:2.1-sdk-stretch AS build
WORKDIR /src
COPY ["DummyService.AcceptanceTests/DummyService.AcceptanceTests.csproj", "DummyService.AcceptanceTests/"]
RUN dotnet restore "DummyService.AcceptanceTests/DummyService.AcceptanceTests.csproj"
COPY . .
WORKDIR "/src/DummyService.AcceptanceTests"
RUN dotnet build "DummyService.AcceptanceTests.csproj" -c Release -o /app
[Story(
Title = "DummyEvent is handled",
AsA = "As a dummy service",
IWant = "I want to handle dummy event",
SoThat = "So that I can get message data inserted in database")]
public class DummyEventHandlingFeature
{
private IDictionary<string, string> _inMemoryStorage = new Dictionary<string, string>();
[Fact]
[Story(
Title = "DummyEvent is handled",
AsA = "As a dummy service",
IWant = "I want to handle dummy event",
SoThat = "So that I can get message data inserted in database")]
public class DummyEventHandlingFeature
{
private IDictionary<string, string> _inMemoryStorage = new Dictionary<string, string>();
[Fact]
version: '3.4'
services:
dummyservice.app:
image: iqan/dummyserviceapp
build:
context: .
dockerfile: DummyService.App/Dockerfile
environment:
- EndpointConfiguration:ConnectionString=<your-servicebus-connectionstring>
USE master
GO
RESTORE DATABASE DummyDatabase
FROM DISK = '/work/db.bak' WITH
MOVE 'DummyDatabase' TO '/var/opt/mssql/data/DummyDatabase/DummyDatabase.mdf',
MOVE 'DummyDatabase_log' TO '/var/opt/mssql/data/DummyDatabase/DummyDatabase_log.ldf'
echo "Setting Environment variables."
export ACCEPT_EULA=Y
export SA_PASSWORD=SuperSecretPassword#1
echo "Environment variables set."
echo "Starting SqlServr"
/opt/mssql/bin/sqlservr &
sleep 60 | echo "Waiting for 60s to start Sql Server"
echo "Restoring DB."
/opt/mssql-tools/bin/sqlcmd -U sa -P SuperSecretPassword#1 -i $1
echo "DB restored."
FROM microsoft/mssql-server-linux
RUN mkdir /work
COPY CreateDb.sql /work
COPY db.sh /work
COPY db.bak /work
WORKDIR /work
FROM microsoft/dotnet:2.2-runtime-stretch-slim AS base
WORKDIR /app
FROM microsoft/dotnet:2.2-sdk-stretch AS build
WORKDIR /src
COPY ["DummyService.App/DummyService.App.csproj", "DummyService.App/"]
RUN dotnet restore "DummyService.App/DummyService.App.csproj"
COPY . .
WORKDIR "/src/DummyService.App"
RUN dotnet build "DummyService.App.csproj" -c Release -o /app