From 62d4ca8af8439ac734a1f3db7286f455d564924c Mon Sep 17 00:00:00 2001 From: doxxx Date: Tue, 24 Oct 2023 23:17:27 +0900 Subject: [PATCH] test: LottoTicketGenerator's generate method --- .../model/lotto/LottoTicketGeneratorTest.kt | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/test/kotlin/model/lotto/LottoTicketGeneratorTest.kt diff --git a/src/test/kotlin/model/lotto/LottoTicketGeneratorTest.kt b/src/test/kotlin/model/lotto/LottoTicketGeneratorTest.kt new file mode 100644 index 0000000..ed43a03 --- /dev/null +++ b/src/test/kotlin/model/lotto/LottoTicketGeneratorTest.kt @@ -0,0 +1,29 @@ +package model.lotto + +import io.kotest.core.spec.style.FreeSpec +import io.kotest.matchers.shouldBe + +class LottoTicketGeneratorTest : FreeSpec( + { + "LottoTicketGenerator 생성" - { + "일정 수의 티켓 생성" { + val count = 5 + val tickets = LottoTicketGenerator.generate(count) + + tickets.size shouldBe count + } + + "수동 티켓 생성" { + val manualNumbers = listOf( + LottoNumbers.from(listOf(1, 2, 3, 4, 5, 6)), + LottoNumbers.from(listOf(7, 8, 9, 10, 11, 12)), + ) + val tickets = LottoTicketGenerator.generate(manualNumbers) + + tickets.size shouldBe manualNumbers.size + + tickets.forEach { it.type shouldBe TicketType.Manual } + } + } + }, +)