public void ValidaAnio_DiferenteAnio_Verdadero() { var DOCValidarAnio = new Mock <IValidarAnio>(); DOCValidarAnio.Setup(DOC => DOC.ValidaAnio(new DateTime(2018, 12, 2), new DateTime(2019, 12, 01))).Returns(true); var SUT = new ValidarAnio(); var result = SUT.ValidaAnio(new DateTime(2018, 12, 2), new DateTime(2019, 12, 01)); Assert.IsFalse(result); }
public void CalculaAnio_DiferenteAnio_MensajeCorrecto() { var DOCCalculaAnio = new Mock <IValidarAnio>(); DOCCalculaAnio.Setup(DOC => DOC.ValidaAnio(new DateTime(2019, 12, 2), new DateTime(2018, 12, 01))).Returns(true); var SUT = new CalcularAnio(DOCCalculaAnio.Object); var result = SUT.CalculaAnio(new DateTime(2019, 12, 2), new DateTime(2018, 12, 01)); //DOCCalculaAnio.Verify(DOC => DOC.ValidaAnio(new DateTime(2019, 12, 2), new DateTime(2019, 12, 01)), Times.Once); Assert.AreEqual("ocurrió hace 1 año.", result); }