Esempio n. 1
0
        public void ValidarDataInicioDataFimTest()
        {
            string dataInicio = "01-07-2017";
            string dataFim    = "21-07-2017";

            Assert.IsTrue(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarDataInicioDataFim(dataInicio.ToDateTime(), dataFim.ToDateTime().ToDateTimeDataFim(), "Validar Data", this.GetType())));
            Assert.IsTrue(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarDataInicioDataFim(dataFim.ToDateTime(), dataFim.ToDateTime().ToDateTimeDataFim(), "Validar Data", this.GetType())));

            Assert.IsFalse(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarDataInicioDataFim(dataFim.ToDateTime(), dataFim.ToDateTime(), "Validar Data", this.GetType())));
            Assert.IsFalse(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarDataInicioDataFim(DateTime.MinValue, DateTime.MaxValue, "Validar Data", this.GetType())));
            Assert.IsFalse(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarDataInicioDataFim(DateTime.MaxValue, DateTime.MinValue, "Validar Data", this.GetType())));
            Assert.IsFalse(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarDataInicioDataFim(null, null, "Validar Data", this.GetType())));
            Assert.IsFalse(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarDataInicioDataFim(null, dataFim.ToDateTime(), "Validar Data", this.GetType())));
            Assert.IsFalse(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarDataInicioDataFim(dataInicio.ToDateTime(), null, "Validar Data", this.GetType())));
            Assert.IsFalse(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarDataInicioDataFim(DateTime.MinValue, dataFim.ToDateTime(), "Validar Data", this.GetType())));
            Assert.IsFalse(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarDataInicioDataFim(dataInicio.ToDateTime(), DateTime.MinValue, "Validar Data", this.GetType())));
            Assert.IsFalse(ValidacoesDominio.IsValid(ValidacoesDominio.ValidarDataInicioDataFim(dataInicio.ToDateTime(), DateTime.MaxValue, "Validar Data", this.GetType())));
        }