Skip to content

Instantly share code, notes, and snippets.

View litichevskiydv's full-sized avatar
☄️
Working hard

Litichevskiy Dmitriy litichevskiydv

☄️
Working hard
View GitHub Profile
@litichevskiydv
litichevskiydv / BaseFixtureForApiTests.cs
Created May 28, 2017 09:58
Base fixture for Web API tests collection
public abstract class BaseApiTestsFixture : IDisposable
{
protected bool Disposed;
public TestServer Server { get; }
public Mock<ILogger> MockLogger { get; }
public IConfigurationRoot Configuration { get; }
public int TimeoutInMilliseconds { get; }
public class BaseServiceClientTests<TFixture, TServiceClient>
where TFixture : BaseApiTestsFixture, new()
where TServiceClient : BaseClient
{
protected readonly TFixture Fixture;
protected readonly TServiceClient ServiceClient;
protected BaseServiceClientTests(TFixture fixture)
{
Fixture = fixture;
@litichevskiydv
litichevskiydv / ApiTestsCollection.cs
Created May 28, 2017 10:04
Tests collection definition class
[CollectionDefinition(nameof(ApiTestsCollection))]
public class ApiTestsCollection : ICollectionFixture<BaseApiTestsFixture<TestsStartup>>
{
}
[Collection(nameof(ApiTestsCollection))]
public class ValuesControllerTests : BaseServiceClientTests<BaseApiTestsFixture<TestsStartup>, ValuesServiceClient>
{
public ValuesControllerTests(BaseApiTestsFixture<TestsStartup> fixture) : base(fixture)
{
}
[Fact]
public void ShouldReturnValues()
{
@litichevskiydv
litichevskiydv / setup.sh
Created July 18, 2017 03:26
Setup script for docker container
#!/bin/bash
/opt/mssql/bin/sqlservr --force-setup -q $MSSQL_COLLATION &
pid=$!
FILE_TO_WATCH=/var/opt/mssql/log/errorlog
SEARCH_PATTERN="Recovery is complete"
cat $FILE_TO_WATCH | grep -qe "$SEARCH_PATTERN"
while [[ $? != 0 ]]; do
@litichevskiydv
litichevskiydv / Dockerfile
Last active July 18, 2017 03:33
Dockerfile for modified Microsoft SQL Server on Linux container
FROM microsoft/mssql-server-linux:latest
LABEL project.url="https://github.com/litichevskiydv/MsSqlTools"
COPY setup.sh /
RUN chmod 777 setup.sh
ENV MSSQL_COLLATION=Cyrillic_General_CI_AS
CMD ./setup.sh && /opt/mssql/bin/sqlservr
namespace ImageValidator
{
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using Dapper;
using JetBrains.Annotations;
using Microsoft.Extensions.Configuration;
language: csharp
env:
- IMAGE_TAG=latest
services:
- docker
mono: none
dotnet: 1.0.4
dist: trusty
branches:
only:
[HttpPost]
public async Task Post([FromBody] DockerRequest request)
{
var body = @"
{
""request"": {
""branch"":""<ImageValidatorBranch>"",
""config"": {
""env"": {
""IMAGE_TAG"": ""<ImageTag>""
@litichevskiydv
litichevskiydv / BuildAndPack.cake
Last active October 7, 2017 13:00
Cake script for building solution and NuGet packages creation
// Target - The task you want to start. Runs the Default task if not specified.
var target = Argument("Target", "Default");
// Configuration - The build configuration (Debug/Release) to use.
var configuration =
HasArgument("Configuration")
? Argument<string>("Configuration")
: EnvironmentVariable("Configuration") ?? "Release";
// The build number to use in the version number of the built NuGet packages.