public void RejectsinvalidChequeNumber() { var moq = new Mock <ISimpleRepo <ChequeVoucherDTO> >(); var sut = new PreparedChequesRepo1(moq.Object); var obj = ValidCheque(); obj.ChequeNumber = 0; sut.IsValidForInsert(obj, out string why).Should().BeFalse(); obj.Id = 123; sut.IsValidForUpdate(obj, out why).Should().BeFalse(); sut.IsValidForDelete(obj, out why).Should().BeTrue(); obj.ChequeNumber = -123; obj.Id = 0; sut.IsValidForInsert(obj, out why).Should().BeFalse(); obj.Id = 123; sut.IsValidForUpdate(obj, out why).Should().BeFalse(); sut.IsValidForDelete(obj, out why).Should().BeTrue(); obj.ChequeNumber = 123; obj.Id = 0; sut.IsValidForInsert(obj, out why).Should().BeTrue(); obj.Id = 123; sut.IsValidForUpdate(obj, out why).Should().BeTrue(); sut.IsValidForDelete(obj, out why).Should().BeTrue(); }
public void Rejectsblankamount() { var moq = new Mock <ISimpleRepo <ChequeVoucherDTO> >(); var sut = new PreparedChequesRepo1(moq.Object); var obj = ValidCheque(); obj.Request.Amount = null; sut.IsValidForInsert(obj, out string why).Should().BeFalse(); obj.Id = 123; sut.IsValidForUpdate(obj, out why).Should().BeFalse(); sut.IsValidForDelete(obj, out why).Should().BeTrue(); obj.Request.Amount = 123456; obj.Id = 0; sut.IsValidForInsert(obj, out why).Should().BeTrue(); obj.Id = 123; sut.IsValidForUpdate(obj, out why).Should().BeTrue(); sut.IsValidForDelete(obj, out why).Should().BeTrue(); }