public void Should_have_interface_type_in_AspectEnvironmen() { Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> checkConcreteType = (environMent, aspects) => { Assert.AreEqual(environMent.InterfaceType, typeof(ITarget)); return aspects; }; var proxiedClass = new Advisor(checkConcreteType, new List<IAspect>()).GetAdvicedProxy<ITarget>(new Target()); proxiedClass.DoneSomething("test"); }
public void Should_be_able_to_get_and_set_values_in_the_AspectEnvironment() { //Given var target = new Target(); Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> jointPointDefinition = JointPointDefinition; var proxiedTarget = new Advisor(jointPointDefinition, new List<IAspect>()).GetAdvicedProxy<ITarget>(target); //Then proxiedTarget.DoneSomething("test"); //When }
public void Should_put_value_in_KeyValueStore() { //Given var keyValueStore = new Mock<IKeyValueStore>(); keyValueStore .Setup(kv => kv.SetValue(It.Is<string>(st => st == "test"), It.IsAny<object>())) .AtMostOnce(); Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> kvSetValueFunc = (environment, aspect) => { environment.SetValue("test", new object()); return aspect; }; var proxiedTarget = new Advisor(kvSetValueFunc, new List<IAspect>()).GetAdvicedProxy<ITarget>(new Target(), keyValueStore.Object); //Then proxiedTarget.DoneSomething("bamm"); //When keyValueStore.VerifyAll(); }