private static void CreateRandomNumberOfQueues() { for (int i = 0; i < RandomUtil.GetRandomNumber(2); i++) { new MsmqConfigurator(RandomUtil.GetRandomString(15)); } }
public void InitWeights(IParameterizedLayer wLayer) { float[] data = new float[wLayer.ParametersStorage.Weights.Size]; for (int i = 0; i < wLayer.ParametersStorage.Weights.Size; i++) { wLayer.ParametersStorage.Weights[i] = (float)RandomUtil.GetRandomNumber(_minValue, _maxValue); } wLayer.ParametersStorage.Weights.Storage.Data = data; }
private static int SendRandomMessagesToQueue(MsmqConfigurator queue) { var numberOfMessages = RandomUtil.GetRandomNumber(2); for (var i = 0; i < numberOfMessages; i++) { queue.SendMessageToQueue(RandomUtil.GetRandomString(50)); } return(numberOfMessages); }
public void Mutate(List <Individual> individuals, float mutationRate) { foreach (var individual in individuals) { var mutatedGenotype = individual.Genotype; for (var i = 0; i < mutatedGenotype.Length; i++) { if (RandomUtil.GetRandomNumber(0, 1) <= mutationRate) { mutatedGenotype[i] = (float)RandomUtil.GetGaussian(0, 1); } } individual.Genotype = mutatedGenotype; } }
public override void SaveEntity_EntityExists_EntityIsUpdated() { var competition = CreateCompetition(); var serie = SerieCommands.SaveSerie(new Serie { Description = RandomUtil.GetRandomString(), IdCompetition = competition.IdCompetition }, Context); Assert.IsNotNull(serie); var teamsToPromote = RandomUtil.GetRandomNumber(1); serie.TeamsPromote = teamsToPromote; serie.SaveSerie(Context); var serieDb = SerieQueries.GetSerieById(Context, serie.IdSerie); Assert.IsNotNull(serieDb.TeamsPromote); Assert.AreEqual(teamsToPromote, serieDb.TeamsPromote); }
public void GetMinimumIntValueAlwaysReturns1() { _integer = RandomUtil.GetRandomNumber(2); Assert.AreEqual(1, _integer.GetMinimumIntValue()); }
public void GetRandomAlphaNumericStringTest_LengthIsGiven_ReturnsStringWithMatchingLenght() { var length = RandomUtil.GetRandomNumber(2); TestReturnedStringValue(RandomUtil.GetRandomAlphaNumericString(length), length); }
public void GetRandomNumberTest_LengthIsOne_ReturnsNumberBetween0And9() { TestReturnedIntValue(1, RandomUtil.GetRandomNumber(1)); }
public void GetRandomNumberTest_NoLengthGiven_ReturnsNumberBetween0And999999() { TestReturnedIntValue(6, RandomUtil.GetRandomNumber()); }
public void GetTitleByPartOfDescription_ReturnsListOfTitles() { var description = RandomUtil.GetRandomString(25); TitleCommands.SaveTitle(new Title { Description = description }, Context); var titles = TitleQueries.GetTitlesByPartOfDescription(Context, description.Substring(RandomUtil.GetRandomNumber(1), RandomUtil.GetRandomNumber(1) + 1)); Assert.IsNotEmpty(titles); Assert.IsNotNull(titles.Where(t => t.Description.Contains(description))); }
public void GetSeriesByPartOfDescription_ReturnsListOfSeries() { var description = RandomUtil.GetRandomString(30); SerieCommands.SaveSerie(new Serie { Description = description }, Context); var series = SerieQueries.GetSeriesByPartOfDescription(Context, description.Substring(RandomUtil.GetRandomNumber(1), RandomUtil.GetRandomNumber(1) + 1)); Assert.IsNotNull(series); Assert.IsNotNull(series.FirstOrDefault(s => s.Description == description)); }
public void GetCompetitionByPartOfDescription_ReturnsListOfCompetitions() { var description = RandomUtil.GetRandomString(200); CompetitionCommands.SaveCompetition(new Competition { Name = RandomUtil.GetRandomString(30), Description = description }, Context); var competitions = CompetitionQueries.GetCompetitionByPartOfDescription(Context, description.Substring(RandomUtil.GetRandomNumber(1), RandomUtil.GetRandomNumber(2) + 1)); Assert.IsNotEmpty(competitions); Assert.IsNotNull(competitions.FirstOrDefault(c => c.Description == description)); }
public void GetCompetitionByPartOfName_ReturnsListOfCompetitions() { var name = RandomUtil.GetRandomString(30); CompetitionCommands.SaveCompetition(new Competition { Name = name, Description = RandomUtil.GetRandomString(150) }, Context); var competitions = CompetitionQueries.GetCompetitionByPartOfName(Context, name.Substring(RandomUtil.GetRandomNumber(1), RandomUtil.GetRandomNumber(1) + 1)); Assert.IsNotEmpty(competitions); Assert.IsNotNull(competitions.FirstOrDefault(c => c.Name == name)); }