public void Should_extract_index_values_from_expressions() { Expression <Func <ExampleForm, object> > expression1 = f => f.DrugTestId; Expression <Func <ExampleForm, object> > expression2 = f => f.DrugTestDrugTestResults[5].SubstanceTested; UINameHelper.ExtractIndexValueFrom(expression1).ShouldBeNull(); UINameHelper.ExtractIndexValueFrom(expression2).ShouldEqual(5); }
public void Should_extract_index_values_from_expressions() { Expression <Func <Stub, object> > expression1 = f => f.Name; Expression <Func <Stub, object> > expression2 = f => f.Subs[5].Number; UINameHelper.ExtractIndexValueFrom(expression1).ShouldBeNull(); UINameHelper.ExtractIndexValueFrom(expression2).ShouldEqual(5); }