public async Task Boalf_Should_Return_TypeOf_Boalf() { await Task.Run(() => { Boalf boalf = new Boalf(); Assert.NotNull(boalf); Assert.IsType <Boalf>(boalf); }); }
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); }); }