public void GetRandomGene_Test() { //GIVEN mockRandom.Setup(m => m.Next(0, 2)).Returns(1); //WHEN var result = unit.GetRandomGene(); //THEN Assert.AreEqual(result, 1); mockRandom.Verify(m => m.Next(0, 2), Times.Once); }