internal RemoveStringToFirstOccurrence(RemoveString removeString, string marker) { _removeString = removeString; _marker = marker; _ignoreCase = false; _position = The.Beginning; }
internal RemoveStringStartingOccurrencePosition(RemoveString removeString, The position, int occurrenceCount, string marker) { _removeString = removeString; _position = position; _occurrenceCount = occurrenceCount; _marker = marker; }
internal InsertStringAfter(InsertString insertString, string marker) { _insertString = insertString; _marker = marker; _ignoreCase = false; _position = The.Beginning; }
internal RemoveValue(string source, string extraction) { _source = source; _extraction = extraction; _ignoreCase = false; _position = The.Beginning; }
private static string RemoveValuesInternal(string source, int? quantity, string extraction, StringComparison comparisonRule, The position = The.Beginning) { if (quantity < 0) throw new ArgumentOutOfRangeException("quantity", "Negative quantity is not supported"); if (quantity == 0) return source; return source.Remove(extraction, (s, e) => { var indexes = source.IndexesOf(extraction, comparisonRule, position); if (quantity != null) indexes = indexes.Take(quantity.Value); if (position == The.End) indexes = indexes.Reverse(); var indexesArray = indexes.ToArray(); if (!indexesArray.Any()) return source; var start = 0; var resultStringLength = source.Length - indexesArray.Length * extraction.Length; var builder = new StringBuilder(resultStringLength); foreach (var index in indexes) { builder.Append(source.Substring(start, index - start)); start = index + extraction.Length; } builder.Append(source.Substring(start)); return builder.ToString(); }); }
internal RemoveStringStartingOccurrenceToOccurrencePosition(RemoveStringStartingOccurrence source, The position, int occurrenceCount, string marker) { _source = source; _position = position; _occurrenceCount = occurrenceCount; _marker = marker; }
internal RemoveStringStartingFirstOccurrencePosition(RemoveString removeString, The position, string marker) { _removeString = removeString; _position = position; _marker = marker; _ignoreCase = false; _from = The.Beginning; }
internal RemoveValues(string source, int quantity, string extraction) { _source = source; _quantity = quantity; _extraction = extraction; _ignoreCase = false; _position = The.Beginning; }
internal InsertStringBeforeOccurrence(InsertString insertString, int occurrenceCount, string marker) { _insertString = insertString; _occurrenceCount = occurrenceCount; _marker = marker; _ignoreCase = false; _position = The.Beginning; }
internal RemoveStringStartingOccurrence(RemoveString removeString, int occurrenceCount, string marker) { _removeString = removeString; _occurrenceCount = occurrenceCount; _marker = marker; _ignoreCase = false; _position = The.Beginning; }
internal RemoveStringStartingOccurrencePositionToOccurrence(RemoveStringStartingOccurrencePosition removeStringStartingOccurrencePosition, int occurrence, string marker) { _removeStringStartingOccurrencePosition = removeStringStartingOccurrencePosition; _occurrence = occurrence; _marker = marker; _ignoreCase = false; _position = The.Beginning; }
internal RemoveStringToOccurrencePosition(RemoveString removeString, The position, int occurrence, string marker) { _removeString = removeString; _position = position; _occurrenceCount = occurrence; _marker = marker; _ignoreCase = false; _from = The.Beginning; }
public static int? IndexOf(this string source, The position, int occurrenceCount, string marker, bool ignoreCase, The from) { var index = source.IndexOf(occurrenceCount, marker, ignoreCase, from); if (index == null) return null; int shift = position == The.StartOf ? 0 : marker.Length; return index.Value + shift; }
public static int? IndexOf(this string source, int occurrenceCount, string marker, bool ignoreCase, The from) { if (occurrenceCount == 0) return null; var indexes = source.IndexesOf(marker, ignoreCase, from).Skip(occurrenceCount - 1); if (!indexes.Any()) return null; return indexes.First(); }
public static string RemoveValues(this string source, int? quantity, string extraction, StringComparison comparisonRule, The position) { switch (position) { case The.Beginning: case The.End: return RemoveValuesInternal(source, quantity, extraction, comparisonRule, position); case The.StartOf: case The.EndOf: default: throw new ArgumentOutOfRangeException("position", "Only Beginning and End positions are supported by Remove().From() method"); } }
public static IEnumerable<int> IndexesOf(this string source, string marker, StringComparison comparisonRule, The position) { switch (position) { case The.Beginning: return source.IndexesOf(marker, comparisonRule); case The.End: return source.LastIndexesOf(marker, comparisonRule); case The.StartOf: case The.EndOf: default: throw new ArgumentOutOfRangeException("position", "Only Beginning and End positions are supported by IndexesOf().From() method"); } }
public static IEnumerable<int> IndexesOf(this string source, string marker, bool ignoreCase, The position) { switch (position) { case The.Beginning: return source.IndexesOf(marker, ignoreCase); case The.End: return source.IndexesOf(marker, ignoreCase).Reverse(); case The.StartOf: case The.EndOf: default: throw new ArgumentOutOfRangeException("position", "Only Beginning and End positions are supported by IndexesOf().From() method"); } }
public static string RemoveStartingOrTo(this string source, string marker, bool ignoreCase, The from, bool isStarting) { switch (from) { case The.Beginning: return source.RemoveStartingOrTo(marker, ignoreCase, isStarting, fromBeginning: true); case The.End: return source.RemoveStartingOrTo(marker, ignoreCase, isStarting, fromBeginning: false); case The.StartOf: case The.EndOf: default: var methodName = isStarting ? "Starting" : "To"; throw new ArgumentOutOfRangeException( "position", "Only Beginning and End positions are supported by Remove().{0}().From() method".f(methodName)); } }
private static string InsertWithChecks(this string source, string insertion, string marker, bool ignoreCase, int occurrenceCount, The position, bool after) { if (occurrenceCount < 0) throw new ArgumentOutOfRangeException("occurrence", "Negative occurrence count is not supported"); if (occurrenceCount == 0) return source; return source.Insert(insertion, marker, (s, i, m) => { var shift = after ? marker.Length : 0; var indexes = s.IndexesOf(m, ignoreCase, position).Take(occurrenceCount).ToArray(); return indexes.Any() ? s.Insert(indexes.Last() + shift, i) : s; }); }
public static string Insert( this string source, string insertion, string marker, bool ignoreCase = false, The position = The.Beginning, int? occurrenceCount = null, bool after = false) { switch (position) { case The.Beginning: case The.End: return occurrenceCount != null ? source.InsertWithChecks(insertion, marker, ignoreCase, occurrenceCount.Value, position, after) : source.InsertWithChecks(insertion, marker, ignoreCase, position, after); case The.StartOf: case The.EndOf: default: throw new ArgumentOutOfRangeException("position", "Only Beginning and End positions are supported by Insert().From() method"); } }
public static string RemoveStartingOrTo(this string source, int occurrenceCount, string marker, bool ignoreCase, The from, bool isStarting) { if (occurrenceCount < 0) throw new ArgumentOutOfRangeException("occurrenceCount", "Negative occurrence count is not supported"); if (occurrenceCount == 0) return source; return source.Remove(marker, (s, m) => { var index = source.IndexOf(occurrenceCount, marker, ignoreCase, from); if (index == null) return source; return isStarting ? source.Substring(0, index.Value) : source.Remove(0, index.Value); }, (s, m) => isStarting ? null : String.Empty); }
public static string RemoveStartingOrToPosition(this string source, The position, int occurrenceCount, string marker, bool ignoreCase, The from, bool isStarting) { if (occurrenceCount < 0) throw new ArgumentOutOfRangeException("occurrenceCount", "Negative occurrence count is not supported"); if (occurrenceCount == 0) return source; switch (position) { case The.StartOf: case The.EndOf: break; case The.Beginning: case The.End: default: throw new ArgumentOutOfRangeException("position", "Only StartOf and EndOf positions are supported by Remove().Starting() method"); } return source.Remove(marker, (s, m) => { var indexes = source.IndexesOf(marker, ignoreCase, from).Skip(occurrenceCount - 1); if (!indexes.Any()) return source; int shift = position == The.StartOf ? 0 : marker.Length; var index = indexes.First() + shift; if (index >= source.Length) return isStarting ? source : String.Empty; return isStarting ? source.Substring(0, index) : source.Remove(0, index); }, (s, m) => { return isStarting || position == The.EndOf ? null : String.Empty; }); }
protected void btnRight2_Click(object sender, EventArgs e) { try { The t = new The(); string SoThe = txtThe.Text; t = data.GetAThe(SoThe); if (t != null) { Session["SoThe"] = SoThe.ToString(); Response.Redirect("NhapMaPin.aspx"); } else { lblmsg.Text = "Thẻ không tồn tại"; } } catch(Exception ex) { Response.Write("<script>alert('"+ex.Message+"');</script>"); } }
public static string RemoveStartingOrTo(this string source, int occurrenceCount, string marker, bool ignoreCase, The from, bool isStarting) { if (occurrenceCount < 0) throw new ArgumentOutOfRangeException("occurrenceCount", "Negative occurrence count is not supported"); if (occurrenceCount == 0) return source; return source.Remove(marker, (s, m) => { var indexes = source.IndexesOf(marker, ignoreCase, from).Skip(occurrenceCount - 1); if (!indexes.Any()) return source; return isStarting ? source.Substring(0, indexes.First()) : source.Remove(0, indexes.First()); }, (s, m) => { return isStarting ? null : String.Empty; }); }
internal RemoveStringToOccurrencePositionIgnoringCaseFrom(RemoveStringToOccurrencePositionIgnoringCase removeStringToOccurrencePositionIgnoringCase, The position) { _removeStringToOccurrencePositionIgnoringCase = removeStringToOccurrencePositionIgnoringCase; _position = position; }
/// <summary> /// Extends IndexesOf.IgnoringCase action with the ability to change starting point. /// </summary> /// <param name="position"> /// Position in source string to start from. Beginning or End value can be used. /// </param> /// <exception cref="System.ArgumentOutOfRangeException">Thrown when StartOf or EndOf position value is used</exception> public static IndexesOfValueIgnoringCaseFrom From(this IndexesOfValueIgnoringCase source, The position) { return new IndexesOfValueIgnoringCaseFrom(source, position); }
internal RemoveValueFrom(RemoveValue removeValue, The position) { _removeValue = removeValue; _position = position; }
internal RemoveStringToFirstOccurrencePosition(RemoveString removeString, The position, string marker) { _removeString = removeString; _position = position; _marker = marker; }
public void should_throw_a_managed_exception() { The.Action(() => sut.CreateNewTemplateFromChart(new CurveChart(), _existingTemplates)).ShouldThrowAn <OSPSuiteException>(); }
public void should_throw_an_exception_explaining_that_the_parameter_cannot_be_found() { The.Action(() => sut.UpdateStartValuesFromSimulation(_identificationParameter)).ShouldThrowAn <OSPSuiteException>(); }
private static string InsertWithChecks(this string source, string insertion, string marker, bool ignoreCase, The position, bool after) { return source.Insert(insertion, marker, (s, i, m) => { var indexShift = 0; var afterShift = after ? marker.Length : 0; var indexes = s.IndexesOf(m, ignoreCase, position).ToArray(); var builder = new StringBuilder(s, insertion.Length * indexes.Length); foreach (var index in indexes) { builder.Insert(index + indexShift + afterShift, insertion); indexShift += insertion.Length; } return builder.ToString(); }); }
/// <summary> /// Load ds ve phat hanh /// </summary> private void LoadDSTheHuy() { grdTheHuy.DataMember = "ListTheHuy"; grdTheHuy.SetDataBinding(The.GetDSThe(), "ListTheHuy"); }
private static string InsertWithChecks(this string source, string insertion, string marker, bool ignoreCase, The position, bool after) { return(source.Insert(insertion, marker, (s, i, m) => { var indexShift = 0; var afterShift = after ? marker.Length : 0; var indexes = s.IndexesOf(m, ignoreCase, position).ToArray(); var builder = new StringBuilder(s, insertion.Length * indexes.Length); foreach (var index in indexes) { builder.Insert(index + indexShift + afterShift, insertion); indexShift += insertion.Length; } return builder.ToString(); })); }
internal RemoveStringStartingOccurrenceToFrom(RemoveStringStartingOccurrenceTo source, The position) { _source = source; _position = position; }
public void should_throw_an_exception_stipulating_that_the_default_alternative_cannot_be_deleted() { The.Action(() => sut.RemoveParameterGroupAlternative(_groupAlternative, _alternative)).ShouldThrowAn <CannotDeleteDefaultParameterAlternativeException>(); }
public void should_throw_an_exception() { The.Action(() => sut.RunBatchAsync(_exportRunOptions)).ShouldThrowAn <OSPSuiteException>(); }
public void should_thrown_an_exception_explaining_that_the_axis_cannot_be_removed() { The.Action(() => { _axisSettingsPresenter.AxisRemoved += Raise.With(new AxisEventArgs(_axisY2)); }).ShouldThrowAn <OSPSuiteException>(); }
public void should_be_able_to_retrieve_all_the_values() { The.Action(() => sut.SetValue(individualId: 2, pkValue: 0.2f)).ShouldThrowAn <Exception>(); }
public void should_use_the_distribution_max_as_upper_bound() { The.Action(() => sut.RandomDeviateIn(_randomGenerator)).ShouldThrowAn <LimitsNotInUniformDistributionFunctionRangeException>(); }
public void should_trow_an_exception() { The.Action(() => VisitorInvoker.InvokeVisit(_visitor, _mySimpleClass)).ShouldThrowAn <AmbiguousVisitMethodException>(); }
public void should_do_nothing() { The.Action(() => VisitorInvoker.InvokeVisit(_visitor, _myVisitableClass)).ShouldThrowAn <UnableToVisitObjectException>(); }
public void should_throw_an_exception() { The.Action(() => sut.Execute()).ShouldThrowAn <OSPSuiteException>(); }
internal RemoveStringStartingFromToOccurrencePosition(RemoveStringStartingFrom source, The position, int occurrenceCount, string marker) { _source = source; _position = position; _occurrenceCount = occurrenceCount; _marker = marker; }
public void should_throw_an_information_exception_explaining_to_the_user_that_the_object_cannot_be_loaeder() { The.Action(() => sut.Load(_relatedItem)).ShouldThrowAn <OSPSuiteException>(); }
public void should_throw_an_exception_stipulating_that_at_least_one_exception_needs_to_be_defined() { The.Action(() => sut.RemoveParameterGroupAlternative(_groupAlternative, _alternative)).ShouldThrowAn <CannotDeleteParameterAlternativeException>(); }
public void should_throw_an_not_unique_id_exception() { The.Action(() => sut.Register(A.Fake <IEntity>().WithId(_entity.Id))).ShouldThrowAn <NotUniqueIdException>(); }
internal RemoveStringStartingOccurrencePositionTo(RemoveStringStartingOccurrencePosition removeStringStartingOccurrencePosition, int position) { _removeStringStartingOccurrencePosition = removeStringStartingOccurrencePosition; _positionIndex = position; _position = The.Beginning; }
public void should_throw_an_exception() { The.Action(() => sut.CreateFor(_simulationParameterSelection, _parameterIdentification)).ShouldThrowAn <DimensionMismatchException>(); }
public void should_throw_an_exception_indicating_that_the_simulation_should_be_calculated_first() { The.Action(() => sut.ExportResultsToExcel(_simulation)).ShouldThrowAn <PKSimException>(); }
public void should_throw_a_MissingMoleculeAmountException() { The.Action(() => sut.MapFromLocal(_reactionPartnerBuilder, _container, _buildConfiguration)).ShouldThrowAn <MissingMoleculeAmountException>(); }
private static string InsertWithChecks(this string source, string insertion, string marker, bool ignoreCase, int occurrenceCount, The position, bool after) { if (occurrenceCount < 0) { throw new ArgumentOutOfRangeException("occurrence", "Negative occurrence count is not supported"); } if (occurrenceCount == 0) { return(source); } return(source.Insert(insertion, marker, (s, i, m) => { var shift = after ? marker.Length : 0; var indexes = s.IndexesOf(m, ignoreCase, position).Take(occurrenceCount).ToArray(); return indexes.Any() ? s.Insert(indexes.Last() + shift, i) : s; })); }
public static bool IsA <T>(this T source, string stringType) { return(The.Same(source.GetType(), The.Type(stringType))); }
public void should_throw_an_exception_if_the_path_does_not_exist_in_the_simulation() { The.Action(() => sut.SetValueByPath(_simulation, pathFrom(_liver.Name, INTRACELLULAR, "TOTO"), 5, throwIfNotFound: true)).ShouldThrowAn <OSPSuiteException>(); }
public void should_throw_an_exception() { The.Action(() => sut.CreatePopulation(_populationCharacteristics)).ShouldThrowAn <OSPSuiteException>(); }
internal RemoveStringStartingFromToFrom(RemoveStringStartingFromTo removeStringStartingFromTo, The position) { _removeStringStartingFromTo = removeStringStartingFromTo; _position = position; }
public void should_throw_an_argument_exception() { The.Action(() => sut.GetBuildingBlockFor(A.Fake <IObjectBase>(), A.Fake <IBuildingBlock>())).ShouldThrowAn <ArgumentException>(); }
public void should_allow_to_start_a_Step_with_an_Arg() { The.StepFrom(@"""Arg"" starting a Step".AsLocation()) .Name.ShouldBe("starting_a_Step"); And.LastStep.Args[0].ShouldBe("Arg"); }
public void should_throw_an_exception() { The.Action(() => sut.RunAsync(_data, (x, t) => x.Id, CancellationToken.None, 4)).ShouldThrowAn <NotUniqueIdException>(); }
void IPositional.Set(The position) { _position = position; }
public InsertStringBeforeOccurrenceFrom(InsertStringBeforeOccurrence insertStringBeforeOccurrence, The position) { _insertStringBeforeOccurrence = insertStringBeforeOccurrence; _position = position; }