public void Initialize() { AspectHelper.CodeGenerated += (sender, args) => Console.WriteLine(args.GeneratedCode); this.target = AspectHelper.Wrap <ITestContract>(new TestImplementation()); TestResultBag.Nullify(); }
public void Mef_Integration_Works() { TestResultBag.Nullify(); this.target.ExecuteUnwrapped(); Assert.IsTrue(TestResultBag.VoidMethodWithNoParametersCalled); Assert.IsFalse(TestResultBag.VoidMethodWithNoParametersEntryCalled); Assert.IsFalse(TestResultBag.VoidMethodWithNoParametersExitCalled); TestResultBag.Nullify(); this.target.ExecuteWrapped(); Assert.IsTrue(TestResultBag.VoidMethodWithNoParametersCalled); Assert.IsTrue(TestResultBag.VoidMethodWithNoParametersEntryCalled); Assert.IsTrue(TestResultBag.VoidMethodWithNoParametersExitCalled); }
public void Normal_Property_Get_And_Set_Work() { var value = this.target.NormalProperty; Assert.IsTrue(TestResultBag.NormalPropertyGetterCalled); Assert.AreEqual(value, TestConstants.NormalPropertyGetValue); Assert.AreEqual(TestResultBag.NormalPropertyGetValue, TestConstants.NormalPropertyGetValue); Assert.IsTrue(TestResultBag.NormalPropertyEntryCalled); Assert.IsTrue(TestResultBag.NormalPropertyExitCalled); TestResultBag.Nullify(); this.target.NormalProperty = TestConstants.NormalPropertySetValue; Assert.IsTrue(TestResultBag.NormalPropertySetterCalled); Assert.IsTrue(TestResultBag.NormalPropertyEntryCalled); Assert.IsTrue(TestResultBag.NormalPropertyExitCalled); Assert.AreEqual(TestResultBag.NormalPropertySetValue, TestConstants.NormalPropertySetValue); }
public void Indexer_Get_And_Set_Work() { var value = this.target[TestConstants.IndexerParameterValue]; Assert.IsTrue(TestResultBag.IndexerGetterCalled); Assert.AreEqual(value, TestConstants.IndexerGetValue); Assert.AreEqual(TestResultBag.IndexerGetValue, TestConstants.IndexerGetValue); Assert.IsTrue(TestResultBag.IndexerEntryCalled); Assert.IsTrue(TestResultBag.IndexerExitCalled); Assert.AreEqual(TestResultBag.IndexerParameterValue, TestConstants.IndexerParameterValue); TestResultBag.Nullify(); this.target[TestConstants.IndexerParameterValue] = TestConstants.IndexerSetValue; Assert.IsTrue(TestResultBag.IndexerSetterCalled); Assert.IsTrue(TestResultBag.IndexerEntryCalled); Assert.IsTrue(TestResultBag.IndexerExitCalled); Assert.AreEqual(TestResultBag.IndexerSetValue, TestConstants.IndexerSetValue); Assert.AreEqual(TestResultBag.IndexerParameterValue, TestConstants.IndexerParameterValue); }