protected virtual string getRandomMemberStringValue(TDbRecord dbRecord) { var b = GetRandom.Bool(); return(b? dbRecord.ValidTo.ToString(CultureInfo.CurrentCulture): dbRecord.ValidFrom.ToString(CultureInfo.CurrentCulture)); }
public static Measure Random() { if (GetRandom.Bool()) { return(BaseMeasure.Random()); } return(DerivedMeasure.Random()); }
[TestMethod] public void ToBooleanVariableTest() { var name = GetRandom.String(); var value = GetRandom.Bool(); var a = Operand.ToVariable(name, value) as BooleanVariable; Assert.AreEqual(name, a.Name); Assert.AreEqual(value, a.Value); }
public void Bool_should_return_a_correct_value() { var sut = new GetRandom(); const double truePercentage = 0.8; var generatedValues = new List <bool>(); 1000.Times(_ => generatedValues.Add(sut.Bool(truePercentage))); generatedValues.Count(x => x == true).ShouldBeInRange(780, 820); }
public void BoolTest() { var b = GetRandom.Bool(); Assert.IsInstanceOfType(b, typeof(bool)); while (true) { if (GetRandom.Bool() == !b) { return; } } }
private static void initTelecomRegistrations(ApplicationDbContext c, List <string> geographicIDs, List <string> telecomIDs) { foreach (var a in geographicIDs) { foreach (var d in telecomIDs) { if (GetRandom.Bool()) { continue; } c.TelecomDeviceRegistrations.Add(new TelecomDeviceRegistrationData { AddressID = a, DeviceID = d }); } } }
public bool IsTriggered(ChronoEventArgs chrono) { _secondsCounter += chrono.Delta; if (_secondsCounter > _twitchFrequency) { if (GetRandom.Bool(_chanceOfTrigger)) { _secondsCounter -= _twitchFrequency; UpdateTriggerFrequency(); return(true); } } return(false); }
private static void initMedicineEffects(SentryDbContext c, List <string> medicineIDs, List <string> effectIDs) { foreach (var a in medicineIDs) { foreach (var d in effectIDs) { if (GetRandom.Bool()) { continue; } c.MedicineEffects.Add( new MedicineEffectsDbRecord() { EffectID = a, MedicineID = d }); } } }
private async Task <List <decimal> > createRandomRates(string id) { var l = new List <decimal>(); var c = GetRandom.UInt8(30); var d = DateTime.Today.AddDays(-c); for (var i = 0; i < c; i++) { var r = GetRandom.Decimal(0); var cID = GetRandom.Bool() ? id : GetRandom.String(); await rates.AddRate(cID, r, d); d = d.AddDays(1); if (cID != id) { continue; } l.Add(r); } return(l); }
private List <string> createRecords(string id, Func <string, NationalCurrencyData> createRecord) { var l = new List <string>(); var c = GetRandom.UInt8(30); for (var i = 0; i < c; i++) { var cID = GetRandom.Bool() ? id : GetRandom.String(); var countryCurrency = createRecord(cID); db.CountryCurrencies.Add(countryCurrency); db.SaveChanges(); if (cID != id) { continue; } l.Add(getOtherId(countryCurrency, cID)); } return(l); }
private List <string> createRecords(string id, Func <string, TelecomDeviceRegistrationData> createRecord) { var l = new List <string>(); var c = GetRandom.UInt8(30); for (var i = 0; i < c; i++) { var cID = GetRandom.Bool() ? id : GetRandom.String(); var deviceRegistration = createRecord(cID); db.TelecomDeviceRegistrations.Add(deviceRegistration); db.SaveChanges(); if (cID != id) { continue; } l.Add(getOtherId(deviceRegistration, cID)); } return(l); }
public void GetRoleRelationshipsTest() { var s = GetRandom.String(); Assert.AreEqual(0, Relationships.GetRoleRelationships(s).Count); var l = Relationships.Random(); foreach (var e in l) { if (GetRandom.Bool()) { e.ConsumerId = s; } else { e.ProviderId = s; } } Relationships.Instance.AddRange(l); Relationships.Instance.AddRange(Relationships.Random()); Assert.AreEqual(l.Count, Relationships.GetRoleRelationships(s).Count); }
public void BoolTest() { var actual = GetRandom.Bool(); actual.ShouldBeOfType <bool>(); }
public void GetRandom_Bool_should_work() { bool randomValue = GetRandom.Bool(); Assert.IsNotNull(randomValue); }
[TestMethod] public void HasNextPageTest() { db.HasNextPage = GetRandom.Bool(); isReadOnlyProperty(obj, nameof(obj.HasNextPage), db.HasNextPage); }
protected override void SetRandomValues() { base.SetRandomValues(); valueField = GetRandom.Bool(); }
[TestMethod] public void ConvertTest() { var s = GetRandom.Bool(); Assert.AreEqual(s, Obj.Convert(s.ToString())); }
public void HasPreviousPageTest() { db.HasPreviousPage = GetRandom.Bool(); IsReadOnlyProperty(obj, nameof(obj.HasPreviousPage), db.HasPreviousPage); }
[TestMethod] public void HasNextPageTest() { Db.HasNextPage = GetRandom.Bool(); IsReadOnlyProperty(Obj, nameof(Obj.HasNextPage), Db.HasNextPage); }
/// <summary> /// Get random <see cref="Bool"/> value. /// </summary> /// <returns>Random <see cref="Bool"/> value.</returns> public static bool Bool() => GetRandom.Bool();