public async Task BoalfValidator_Validate_Should_Return_True_When_No_Record_To_Validate() { await Task.Run(() => { List <Boalf> boalfs = new List <Boalf>(); List <ParticipantEnergyAsset> participantEnergyAsset = new List <ParticipantEnergyAsset>(); List <BoalfIndexTable> updateOrInsFlow = new List <BoalfIndexTable>(); Aggregate <Boalf> aggregate = new Aggregate <Boalf>(new Item(), boalfs, participantEnergyAsset, updateOrInsFlow); BoalfValidator validator = new BoalfValidator(); FluentValidation.Results.ValidationResult result = validator.Validate(aggregate); Assert.True(result.IsValid); }); }
public async Task BoalfValidator_Validate_Should_Return_True_When_ForParticularBMUnitBoAcceptanceNumberBoAcceptanceTimeIfAmendmentFlagUPD_ThereShouldberecordReceivedEarlier() { await Task.Run(() => { //Arrange List <Boalf> boalf = _mockData.GetBoalfs().Skip(31).Take(1).ToList(); List <ParticipantEnergyAsset> bmuUnit = _mockData.GetBMUParticipant(); List <BoalfIndexTable> boalfIndexTables = _mockData.GetUpdateorINSFlow().Skip(6).Take(1).ToList(); Aggregate <Boalf> aggregate = new Aggregate <Boalf>(new Item(), boalf, bmuUnit, boalfIndexTables); BoalfValidator validator = new BoalfValidator(); //Act FluentValidation.Results.ValidationResult result = validator.Validate(aggregate, ruleSet: BusinessValidationConstants.WARNINGCHECK); //Assert Assert.True(result.IsValid); }); }
public async Task BoalfValidator_Validate_Should_Return_True_When_BMUUnit_Is_Valid() { await Task.Run(() => { //Arrange List <Boalf> boalf = _mockData.GetBoalfs().Skip(21).Take(2).ToList(); List <ParticipantEnergyAsset> bmuUnit = _mockData.GetBMUParticipant(); List <BoalfIndexTable> updateOrInsFlow = _mockData.GetUpdateorINSFlow(); Aggregate <Boalf> aggregate = new Aggregate <Boalf>(new Item(), boalf, bmuUnit, updateOrInsFlow); BoalfValidator validator = new BoalfValidator(); //Act FluentValidation.Results.ValidationResult result = validator.Validate(aggregate, ruleSet: BusinessValidationConstants.WARNINGCHECK); //Assert Assert.True(result.IsValid); }); }
public async Task BoalfValidator_Validate_Should_Return_True_When_AmendmentFlagIsORIOrINSOrUPDOrDEL() { await Task.Run(() => { //Arrange List <Boalf> boalf = _mockData.GetBoalfs().Skip(32).Take(1).ToList(); List <ParticipantEnergyAsset> bmuUnit = _mockData.GetBMUParticipant(); boalf.FirstOrDefault().AmendmentFlag = "False"; List <BoalfIndexTable> boalfIndexTables = _mockData.GetUpdateorINSFlow().Skip(7).Take(1).ToList(); Aggregate <Boalf> aggregate = new Aggregate <Boalf>(new Item(), boalf, bmuUnit, boalfIndexTables); BoalfValidator validator = new BoalfValidator(); //Act FluentValidation.Results.ValidationResult result = validator.Validate(aggregate, ruleSet: BusinessValidationConstants.WARNINGCHECK); //Asert Assert.False(result.IsValid); }); }
public async Task BoalfValidator_Validate_Should_Return_False_ForParticularBMUniBoAcceptanceNumberBoAcceptanceTimeIfAmendmentFlagUPD_ThereShouldNotbeRecordReceivedEarlier() { await Task.Run(() => { //Arrange List <Boalf> boalf = _mockData.GetBoalfs().Skip(32).Take(1).ToList(); List <ParticipantEnergyAsset> bmuUnit = _mockData.GetBMUParticipant(); List <BoalfIndexTable> boalfIndexTables = _mockData.GetUpdateorINSFlow().Skip(7).Take(1).ToList(); Aggregate <Boalf> aggregate = new Aggregate <Boalf>(new Item(), boalf, bmuUnit, boalfIndexTables); BoalfValidator validator = new BoalfValidator(); //Act FluentValidation.Results.ValidationResult result = validator.Validate(aggregate, ruleSet: BusinessValidationConstants.WARNINGCHECK); //Assert Assert.False(result.IsValid); Assert.Equal(result.Errors[0].ToString(), BusinessValidationConstants.BOALF_MSG_AMMENDMENTFLAG_UPD_OR_DEL); }); }
public async Task boalfValidator_Validate_Should_Return_False_When_TimeFromOfPreviousRecordNotToTimetoOfNextRecord() { await Task.Run(() => { //Arrange List <Boalf> boalf = _mockData.GetBoalfs().Skip(19).Take(2).ToList(); List <ParticipantEnergyAsset> bmuUnit = _mockData.GetBMUParticipant(); List <BoalfIndexTable> updateOrInsFlow = _mockData.GetUpdateorINSFlow(); Aggregate <Boalf> aggregate = new Aggregate <Boalf>(new Item(), boalf, bmuUnit, updateOrInsFlow); BoalfValidator validator = new BoalfValidator(); //Act FluentValidation.Results.ValidationResult result = validator.Validate(aggregate, ruleSet: BusinessValidationConstants.WARNINGCHECK); //Assert Assert.False(result.IsValid); Assert.Equal(result.Errors.FirstOrDefault().ToString(), BusinessValidationConstants.BOALF_MSG_DIFFERENTTIMETOOFPREVIOUSRECORDANDTIMEFROMOFNEXTRECORD); }); }
public async Task boalfValidator_Validate_Should_Return_False_When_SameBMUNameBidOfferAcceptanceNumberAcceptanceTime_HaveDifferentStoreFlag() { await Task.Run(() => { //Arrange List <Boalf> boalf = _mockData.GetBoalfs().Skip(15).Take(2).ToList(); List <ParticipantEnergyAsset> bmuUnit = _mockData.GetBMUParticipant(); List <BoalfIndexTable> updateOrInsFlow = _mockData.GetUpdateorINSFlow(); Aggregate <Boalf> aggregate = new Aggregate <Boalf>(new Item(), boalf, bmuUnit, updateOrInsFlow); BoalfValidator validator = new BoalfValidator(); //Act FluentValidation.Results.ValidationResult result = validator.Validate(aggregate, ruleSet: BusinessValidationConstants.WARNINGCHECK); //Assert Assert.False(result.IsValid); Assert.Equal(result.Errors.FirstOrDefault().ToString(), BusinessValidationConstants.BOALF_MSG_DIFFERENTDEEMEDBIDOFFERFLAG_OR_SOFLAG_OR_AMMENDMENTFLAG_OR_STORFLAG); }); }
public async Task BoalfValidator_Validate_Should_Return_False_When_AmendmentFlagIsNotORIOrINSOrUPDOrDEL() { await Task.Run(() => { //Arrange List <Boalf> boalf = _mockData.GetBoalfs().Skip(32).Take(1).ToList(); boalf.FirstOrDefault().AmendmentFlag = BusinessValidationConstants.ISFALSE; List <ParticipantEnergyAsset> bmuUnit = _mockData.GetBMUParticipant(); List <BoalfIndexTable> boalfIndexTables = _mockData.GetUpdateorINSFlow().Skip(7).Take(1).ToList(); Aggregate <Boalf> aggregate = new Aggregate <Boalf>(new Item(), boalf, bmuUnit, boalfIndexTables); BoalfValidator validator = new BoalfValidator(); //Act FluentValidation.Results.ValidationResult result = validator.Validate(aggregate, ruleSet: BusinessValidationConstants.WARNINGCHECK); //Asert Assert.False(result.IsValid); Assert.Equal(result.Errors[0].ToString(), BusinessValidationConstants.BOALF_MSG_AMENDMENTFLAGNOTHAVEORI_OR_INS_OR_DEL_OR_UPD); }); }
public async Task boalfValidator_Validate_Should_Return_False_When_ForSameBMUUnitAndBidOfferAcceptanceNumber_HaveDifferentAcceptanceTime() { await Task.Run(() => { //Arrange List <Boalf> boalf = _mockData.GetBoalfs().Skip(1).Take(2).ToList(); List <ParticipantEnergyAsset> bmuUnit = _mockData.GetBMUParticipant(); List <BoalfIndexTable> updateOrInsFlow = _mockData.GetUpdateorINSFlow(); boalf[0].AcceptanceTime = new DateTime(2018, 04, 09, 14, 30, 00); Aggregate <Boalf> aggregate = new Aggregate <Boalf>(new Item(), boalf, bmuUnit, updateOrInsFlow); BoalfValidator validator = new BoalfValidator(); //Act FluentValidation.Results.ValidationResult result = validator.Validate(aggregate, ruleSet: BusinessValidationConstants.WARNINGCHECK); //Assert Assert.False(result.IsValid); Assert.Equal(result.Errors.FirstOrDefault().ToString(), BusinessValidationConstants.BOALF_MSG_DIFFERENTACCEPTANCETIME); }); }
public async Task BoalfValidator_Validate_Should_Return_False_When_IsDeemedBidOfferFlagOrSoFlagOrStorFlagNothaveTrueOrFalse() { await Task.Run(() => { //Arrange List <Boalf> boalf = _mockData.GetBoalfs().Skip(32).Take(1).ToList(); boalf.FirstOrDefault().DeemedBidOfferFlag = BusinessValidationConstants.UPDATEORINS; boalf.FirstOrDefault().StorFlag = BusinessValidationConstants.AMMENDMENTFLAGUPD; boalf.FirstOrDefault().SoFlag = BusinessValidationConstants.AMMENDMENTFLAGDEL; List <ParticipantEnergyAsset> bmuUnit = _mockData.GetBMUParticipant(); List <BoalfIndexTable> boalfIndexTables = _mockData.GetUpdateorINSFlow().Skip(7).Take(1).ToList(); Aggregate <Boalf> aggregate = new Aggregate <Boalf>(new Item(), boalf, bmuUnit, boalfIndexTables); BoalfValidator validator = new BoalfValidator(); //Act FluentValidation.Results.ValidationResult result = validator.Validate(aggregate, ruleSet: BusinessValidationConstants.WARNINGCHECK); //Asert Assert.False(result.IsValid); Assert.Equal(result.Errors[0].ToString(), BusinessValidationConstants.BOALF_MSG_DEEMEDBIDOFFERFLAG_OR_SOFLAG_OR_STORFLAGSHOULDBETRUEORFALSE); }); }
public async Task boalfValidator_Validate_Should_Return_True_When_TimeFrom_IsLessThan_TimeTo() { await Task.Run(() => { //Arrange List <Boalf> boalfs = new List <Boalf>(); Boalf boalf = _mockData.GetBoalfs().FirstOrDefault(); List <ParticipantEnergyAsset> bmuUnit = _mockData.GetBMUParticipant(); List <BoalfIndexTable> updateOrInsFlow = _mockData.GetUpdateorINSFlow(); boalf.TimeFrom = new DateTime(2018, 04, 09, 14, 00, 00); boalf.TimeTo = new DateTime(2018, 04, 09, 14, 30, 00); boalfs.Add(boalf); Aggregate <Boalf> aggregate = new Aggregate <Boalf>(new Item(), boalfs, bmuUnit, updateOrInsFlow); BoalfValidator Validator = new BoalfValidator(); //Act FluentValidation.Results.ValidationResult result = Validator.Validate(aggregate, ruleSet: BusinessValidationConstants.WARNINGCHECK); //Assert Assert.True(result.IsValid); }); }
public async Task boalfValidator_Validate_Should_Return_False_When_TimeFrom_And_TimeTo_HaveGreaterThanFourHoursDifference() { await Task.Run(() => { //Arrange List <Boalf> boalfs = new List <Boalf>(); Boalf boalf = _mockData.GetBoalfs().FirstOrDefault(); List <ParticipantEnergyAsset> bmuUnit = _mockData.GetBMUParticipant(); List <BoalfIndexTable> updateOrInsFlow = _mockData.GetUpdateorINSFlow(); boalf.TimeFrom = new DateTime(2018, 11, 10, 00, 00, 00); boalf.TimeTo = new DateTime(2018, 11, 10, 05, 00, 00); boalfs.Add(boalf); Aggregate <Boalf> aggregate = new Aggregate <Boalf>(new Item(), boalfs, bmuUnit, updateOrInsFlow); BoalfValidator validator = new BoalfValidator(); //Act FluentValidation.Results.ValidationResult result = validator.Validate(aggregate, ruleSet: BusinessValidationConstants.WARNINGCHECK); //Assert Assert.False(result.IsValid); Assert.Equal(result.Errors.FirstOrDefault().ToString(), BusinessValidationConstants.BOALF_MSG_FROMTIMEANDTOTIMEHAVEONLYFOURHOURDIFFERENCE); }); }
public async Task BoalfValidator_Validate_Should_Return_False_When_TimeFrom_IsGreaterThan_TimeTo() { await Task.Run(() => { //Arrange List <Boalf> boalfs = new List <Boalf>(); Boalf boalf = _mockData.GetBoalfs().FirstOrDefault(); List <ParticipantEnergyAsset> bmuUnit = _mockData.GetBMUParticipant(); List <BoalfIndexTable> updateOrInsFlow = _mockData.GetUpdateorINSFlow(); boalf.TimeFrom = new DateTime(2018, 11, 10, 0, 30, 00); boalf.TimeTo = new DateTime(2018, 11, 10, 0, 00, 00); boalfs.Add(boalf); Aggregate <Boalf> aggregate = new Aggregate <Boalf>(new Item(), boalfs, bmuUnit, updateOrInsFlow); BoalfValidator validator = new BoalfValidator(); //Act FluentValidation.Results.ValidationResult result = validator.Validate(aggregate, ruleSet: BusinessValidationConstants.WARNINGCHECK); //Assert Assert.False(result.IsValid); Assert.Equal(result.Errors.FirstOrDefault().ToString(), BusinessValidationConstants.MSG_TIMEFROMGREATERTHANTIMETO); }); }