forked from tom.biard/ScienceQuest
parent
ac75980226
commit
34d852acb1
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4">
|
||||
<component name="ModuleClassLoaderOverlays">
|
||||
<paths>
|
||||
<option value="/tmp/overlay16255881331565398814" />
|
||||
<option value="/tmp/overlay3325279776421233033" />
|
||||
</paths>
|
||||
</component>
|
||||
</module>
|
@ -1,17 +0,0 @@
|
||||
package fr.iut.sciencequest
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package fr.iut.sciencequest.viewModel
|
||||
|
||||
import fr.iut.sciencequest.testRules.MainDispatcherRule
|
||||
import fr.iut.sciencequest.viewModels.LoginViewModel
|
||||
import org.junit.Assert
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
@RunWith(Parameterized::class)
|
||||
class LoginViewModelTest(
|
||||
val exempleString: String
|
||||
) {
|
||||
|
||||
@get:Rule
|
||||
val mainDispatcherRule = MainDispatcherRule()
|
||||
|
||||
@Test
|
||||
fun setMdpTest() {
|
||||
val viewModel = LoginViewModel()
|
||||
|
||||
viewModel.setMdp(exempleString)
|
||||
Assert.assertEquals(exempleString, viewModel.uiState.value.mdp)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun setPseudoTest() {
|
||||
val viewModel = LoginViewModel()
|
||||
|
||||
viewModel.setPseudo(exempleString)
|
||||
Assert.assertEquals(exempleString, viewModel.uiState.value.pseudo)
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
@Parameterized.Parameters(
|
||||
name = "Quand joueur joue {0}, le jeu est censé trouvé que {1} est {3} et il lui reste {2} "
|
||||
)
|
||||
fun getTestActionData(): Iterable<Array<Any>> {
|
||||
return arrayListOf(
|
||||
arrayOf("Jean"),
|
||||
arrayOf("jean"),
|
||||
arrayOf("Jean2"),
|
||||
arrayOf("jean2"),
|
||||
arrayOf("jean_"),
|
||||
arrayOf("jean+"),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue