public void ConditionallyThrowingInvalidOperationException(bool shouldThrow) { TestRecords.RecordBody("VoidMethodConditionallyThrowingInvalidOperationException", "enter"); if (shouldThrow) { throw new InvalidOperationException("Ooops"); } TestRecords.RecordBody("VoidMethodConditionallyThrowingInvalidOperationException", "not throw"); }
public void MultipleReturnValuesButEndingWithThrow(int returnAt) { TestRecords.RecordBody("MultipleReturnValuesButEndingWithThrow", "0"); if (returnAt == 1) { return; } TestRecords.RecordBody("MultipleReturnValuesButEndingWithThrow", "1"); if (returnAt == 2) { return; } TestRecords.RecordBody("MultipleReturnValuesButEndingWithThrow", "2"); throw new InvalidOperationException("Ooops"); }
public int MultipleReturns(int input) { TestRecords.RecordBody("MultipleReturns", "0"); if (input == 1) { return(7); } TestRecords.RecordBody("MultipleReturns", "1"); if (input == 2) { return(14); } TestRecords.RecordBody("MultipleReturns", "2"); return(input == 3 ? 21 : 28); }
public void WithMultipleReturns(int returnAt) { // This is compiled such that each return statement essentially becomes // a branch to the very last ret statement TestRecords.RecordBody("VoidMethodWithMultipleReturns", "0"); if (returnAt == 1) { return; } TestRecords.RecordBody("VoidMethodWithMultipleReturns", "1"); if (returnAt == 2) { return; } TestRecords.RecordBody("VoidMethodWithMultipleReturns", "2"); if (returnAt == 3) { return; } TestRecords.RecordBody("VoidMethodWithMultipleReturns", "3"); }
public int MultipleReturnValuesButWithEmbeddedThrow(int returnAt) { TestRecords.RecordBody("MultipleReturnValuesButWithEmbeddedThrow", "0"); if (returnAt == 1) { return(42); } TestRecords.RecordBody("MultipleReturnValuesButWithEmbeddedThrow", "1"); if (returnAt == 2) { throw new InvalidOperationException("Ooops"); } TestRecords.RecordBody("MultipleReturnValuesButWithEmbeddedThrow", "2"); TestRecords.RecordBody("MultipleReturnValuesButWithEmbeddedThrow", "2"); return(164); }
public void WithMultipleReturnsAndExceptions(int actAt, bool shouldThrow) { TestRecords.RecordBody("WithMultipleReturnsAndExceptions", "0"); if (actAt == 1) { if (shouldThrow) { throw new InvalidOperationException("Throwing at 1"); } return; } TestRecords.RecordBody("WithMultipleReturnsAndExceptions", "1"); if (actAt == 2) { if (shouldThrow) { throw new InvalidOperationException("Throwing at 2"); } return; } TestRecords.RecordBody("WithMultipleReturnsAndExceptions", "2"); if (actAt == 3) { if (shouldThrow) { throw new InvalidOperationException("Throwing at 3"); } return; } TestRecords.RecordBody("WithMultipleReturnsAndExceptions", "3"); }
public static string ToTitleCase(this string value) { TestRecords.RecordBody("ToTitleCase"); return(new CultureInfo("en-GB", false).TextInfo.ToTitleCase(value)); }
public void ThrowingInvalidOperationException() { TestRecords.RecordBody("VoidMethodThrowingInvalidOperationException"); throw new InvalidOperationException("Ooops"); }
public void ExternalInterceptorDecorated() { TestRecords.RecordBody("ExternalInterceptorDecorated"); }
public void ExternalInterceptorAssemblyLevelDecorated() { TestRecords.RecordBody("ExternalInterceptorAssemblyLevelDecorated"); }
public void CanLogInitEntryAndExit() { TestRecords.RecordBody("CanLogInitEntryAndExit"); }
public void CanLogInitEntryAndException() { TestRecords.RecordBody("CanLogInitEntryAndException"); throw new ApplicationException("boo!"); }
public string ReturnsString() { TestRecords.RecordBody("ReturnsString"); return("hello world"); }
protected virtual void ProtectedVirtualMethodNotDecorated() { TestRecords.RecordBody("ProtectedVirtualMethodNotDecorated"); }
public virtual void PublicVirtualMethodNotDecorated() { TestRecords.RecordBody("PublicVirtualMethodNotDecorated"); }
public void PublicNewMethodNotDecorated() { TestRecords.RecordBody("PublicNewMethodNotDecorated"); }
public override void PublicVirtualMethodNotDecorated() { TestRecords.RecordBody("PublicOverridedVirtualMethodNotDecorated"); }
public int ReturnsNumber() { TestRecords.RecordBody("ReturnsNumber"); return(42); }
public void WithoutArgs() { TestRecords.RecordBody("VoidMethodWithoutArgs"); }
public SimpleConstructor() { TestRecords.RecordBody("InterceptingConstructors+SimpleConstructor"); }
public void ObsoleteDecorated() { TestRecords.RecordBody("ObsoleteDecorated"); }
public String PublicNewMethodNotDecorated() { TestRecords.RecordBody("PublicNewMethodNotDecorated"); return("returns PublicNewMethodNotDecorated"); }