A step-by-step guide to running .NET integration tests with Testcontainers using Docker Engine inside WSL2, without Docker Desktop.
| # | OS | WSL Version | Docker Version | Distro |
|---|
| public static class ObjectExtensions | |
| { | |
| public static bool HasValueProperty(this object obj, string propertyName) | |
| { | |
| if (!obj.ExistsProperty(propertyName)) | |
| return false; | |
| var type = obj.GetType(); | |
| var properties = type.GetProperties(); | |
| var allProperties = AllProperties(properties); |
| function isValidCPF(number) { | |
| var sum; | |
| var rest; | |
| sum = 0; | |
| if (number == "00000000000") return false; | |
| for (i=1; i<=9; i++) sum = sum + parseInt(number.substring(i-1, i)) * (11 - i); | |
| rest = (sum * 10) % 11; | |
| if ((rest == 10) || (rest == 11)) rest = 0; |
| public bool IsValidCPF(string value) | |
| { | |
| if (value == null) | |
| return false; | |
| value = value.NormalizeString(); | |
| if (value.Length != 11) | |
| return false; | |
| var cpf = value.Select(c => c.ToInt()).ToList(); |
| public class AuthenticationManagerCustom implements AuthenticationManager{ | |
| @Autowired | |
| private UserService userService; | |
| @Override | |
| public Authentication authenticate(Authentication auth) throws AuthenticationException { | |
| String username = auth.getName(); | |
| String password = auth.getCredentials().toString(); | |
| NFSeProxy.ComponenteNFSe.ImpressaoModo = ModoImpressao.printNFSe; | |
| NFSeProxy.ComponenteNFSe.Impressao_CriarDatasets(xml); | |
| NFSeProxy.ComponenteNFSe.Impressao_Editar(); | |
| NFSeProxy.ComponenteNFSe.Impressao_SetCampo("OutrasInformacoes", @"*** DOCUMENTO EMITIDO POR ME OU EPP OPTANTE PELO SIMPLES NACIONAL *** | |
| O prestador do (s)serviço(s) possui regime especial de tributação: Microempresário e Empresa de Pequeno Porte(ME -EPP) | |
| Valor aproximado dos tributos com base na Lei 12.741 / 2012 - R$ 368,26 - (18, 45 %) - Fonte: IBPT"); | |
| NFSeProxy.ComponenteNFSe.Impressao_Salvar(); |
| @Entity | |
| @Table(name="roles") | |
| public class Role{ | |
| //Contructor | |
| public Role(...){}; | |
| @Id | |
| @GeneratedValue(strategy = GenerationType.IDENTITY) |
| var xml = spdNFSeConverterX.ConverterEnvioNFSe(tx2); | |
| var xmlAssinado = spdProxyNFSeX.Assinar(xml); | |
| spdProxyNFSeX.Enviar(xmlAssinado, ""); | |
| var xmlResposta = File.ReadAllText(NFSeProxy.ComponenteNFSe.UltimoLogRecibo); | |
| var retorno = IspdNFSeConverterX.ConverterRetEnvioNFSeTipo(xmlResposta); | |
| var protocoloConsulta = retorno?.NumeroProtocolo; |
| package com.zieg.ApplicationManager; | |
| import org.springframework.boot.SpringApplication; | |
| import org.springframework.boot.autoconfigure.SpringBootApplication; | |
| import org.springframework.data.jpa.repository.config.EnableJpaAuditing; | |
| @EnableJpaAuditing | |
| @SpringBootApplication | |
| public class ApplicationManager { |
| function divisao(dividendo, divisor){ | |
| var quociente = 0; | |
| var resto = 0; | |
| while(dividendo > 0 && dividendo >= divisor){ | |
| quociente = soma(quociente, 1); | |
| dividendo = subtrair(dividendo, divisor); | |
| } | |
| resto = dividendo; | |