This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class BuyCryptoInfo( | |
val username: String, | |
val phoneNumber: PhoneNumber, | |
val creditCard: CreditCard, | |
val kycVerification: KycVerificationData) | |
fun becomeRich(crypto: CryptoInfo, buyInfo: BuyCryptoInfo) = TODO("conquer the world") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class CryptoUser( | |
val username: String, | |
val name: PersonalName, | |
val email: Email, | |
val phoneNumber: PhoneNumber? = null, | |
val creditCard: CreditCard? = null, | |
val kycVerification: KycVerificationData? = null) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void Main(string[] args) | |
{ | |
// parsing dell'input | |
int[] inputNumbers = args.Select(int.Parse).ToArray(); | |
// calcolo della totalizzazione | |
int total = inputNumbers.Sum() | |
// stampa del totale in output | |
Console.WriteLine(total); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void Main(string[] args) | |
{ | |
Console.WriteLine(args.Select(int.Parse).Sum()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
fun `GIVEN springboot in certain state WHEN a restart happens THEN it should preserve the state`(){ | |
val restTemplate = TestRestTemplate() | |
var webserverPort = Random.nextInt(10000, 10100) | |
val appContext = SpringApplication.run(MainApplication::class.java, "--server.port=$webserverPort") | |
restTemplate.getForObject<String>("http://localhost:$webserverPort/hello") shouldBe "Ok 0" | |
appContext.registerShutdownHook() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HelloTests { | |
@Test | |
fun `GIVEN springboot in certain state WHEN a restart happens THEN it should preserve the state`(){ | |
val restTemplate = TestRestTemplate() | |
val webserverPort = Random.nextInt(10000, 10100) | |
val appContext = SpringApplication.run(MainApplication::class.java, "--server.port=$webserverPort") | |
restTemplate.getForObject<String>("http://localhost:$webserverPort/hello") shouldBe "Ok 0" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = [MainApplication::class]) | |
class HelloTests(@Autowired val restTemplate: TestRestTemplate) { | |
@Test | |
fun `GIVEN springboot in certain state WHEN a restart happens THEN it should preserve the state`(){ | |
restTemplate.getForObject<String>("/hello") shouldBe "Ok 0" | |
restart() | |
restTemplate.getForObject<String>("/hello") shouldBe "Ok 1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[FunctionName("HappyDarioBot")] | |
public static async Task<HttpResponseMessage> Run([HttpTrigger(WebHookType = "genericJson")]HttpRequestMessage req, ILogger log) | |
{ | |
log.LogInformation("DarioBot was triggered!"); | |
string jsonContent = await req.Content.ReadAsStringAsync(); | |
log.LogInformation(jsonContent); | |
return req.CreateResponse(HttpStatusCode.OK); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface ArticleConsumer { | |
fun use(article: ItaArticle) | |
fun use(article: DeuArticle) | |
fun use(article: ArticleNotFound) | |
} | |
fun useAnArticle(article: Article) : String { | |
var x = "" | |
article.applyTo(object : ArticleConsumer { |