This a collection of interesting links found in The Imposter's Handbook by Rob Conery.
Content:
This a collection of interesting links found in The Imposter's Handbook by Rob Conery.
Content:
| using Microsoft.Extensions.Configuration; | |
| using Newtonsoft.Json; | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Threading.Tasks; | |
| namespace Doge.Utils | |
| { |
| It took me too much time to get it working, so I'll describe steps of how to use UserSecrets in testing. | |
| 1. Create Unit test project for .net core | |
| 2. reference Microsoft.AspNetCore.Mvc.Testing , Microsoft.Extensions.Configuration and Microsoft.Extensions.Configuration.UserSecrets | |
| 3. Add a user secret tag to your assembly: | |
| [assembly: UserSecretsId("your_user_secret_id")] | |
| namespace XUnitTestProject1 | |
| { | |
| ... |
| return true switch | |
| { | |
| _ when a == b => 1, | |
| _ when foo == "foobar" => 2, | |
| _ when someFunction() => 3, | |
| _ => 4, | |
| }; | |
| https://www.reddit.com/r/csharp/comments/dccpx9/using_pattern_matching_to_replace_lengthy_ifelse/ |
| image: mcr.microsoft.com/dotnet/core/sdk:3.1 | |
| stages: | |
| - build | |
| - test | |
| - release | |
| - deploy |
| image: mcr.microsoft.com/dotnet/core/sdk:3.1 | |
| stages: | |
| - build | |
| build: | |
| stage: build | |
| script: | |
| - cd tortest2 | |
| - dotnet restore scraperTest.sln |
| image: mcr.microsoft.com/dotnet/core/sdk:3.1 | |
| stages: | |
| - build | |
| - test | |
| build: | |
| stage: build | |
| script: | |
| - cd tortest2 | |
| - dotnet restore scraperTest.sln |
| public abstract class BaseImplementation | |
| { | |
| public abstract void GoToCut(MiniMachine m, Cut cut, bool isScanning); | |
| public abstract void CutMe(MiniMachine m, Cut cut); | |
| public abstract void ScanMe(MiniMachine m, Cut cut); | |
| } | |
| public interface ICuttingImpl |
| public abstract class TestBase | |
| { | |
| protected abstract Task Impl(); | |
| protected abstract void Impl2(); | |
| } | |
| public class Test : TestBase | |
| { | |
| protected override Task Impl() | |
| { |
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |