public ISetImplementation Clone() { var s = new SimpleImplementation(); foreach (var pair in m_substitutions) s.AddSubs(pair.Key, pair.Value); return s; }
public void testSimpleImplementation2() { var x = new SimpleImplementation(); x.Foo(); AssertTrue(true); }
public void testSimpleImplementation1() { ISimpleInterface x = new SimpleImplementation(); x.Foo(); AssertTrue(true); }
public void MethodMultiObjects() { SimpleImplementation obj1 = new SimpleImplementation(); OutAndRefImplementation obj2 = new OutAndRefImplementation(); BeethovenFactory factory = new BeethovenFactory(); ITestMethods test = factory.Generate <ITestMethods>(obj1, obj2); string text1 = "abc"; Assert.AreEqual(19, test.OutAndRef(out string _, ref text1, 5)); test.Simple(); }
public void LinkedMethodsTest2() { SimpleImplementation implementation = new SimpleImplementation(); BeethovenFactory beethovenFactory = new BeethovenFactory(); ITestMethods instance = beethovenFactory.Generate <ITestMethods>( new LinkedMethods(nameof(ITestMethods.Simple)) .AutoMappedMethod(implementation) .Action((int value) => { })); instance.Simple(); Assert.Fail(); }
public void LinkedMethodsTest1() { List <string> log = new List <string>(); SimpleImplementation implementation = new SimpleImplementation(); BeethovenFactory beethovenFactory = new BeethovenFactory(); ITestMethods instance = beethovenFactory.Generate <ITestMethods>( new LinkedMethods(nameof(ITestMethods.Simple)) .Action(() => log.Add("Before")) .AutoMappedMethod(implementation) .Action(() => log.Add("After"))); instance.Simple(); CollectionAssert.AreEquivalent(new[] { "Before", "After" }, log); }
public void LinkedMethodsTest10() { List <string> log = new List <string>(); SimpleImplementation implementation = new SimpleImplementation(); BeethovenFactory beethovenFactory = new BeethovenFactory(); ITestMethods instance = beethovenFactory.Generate <ITestMethods>( new LinkedObjects( ActionMethod.Create("Simple", () => log.Add("Before")), implementation, ActionMethod.Create("Simple", () => log.Add("After")))); instance.Simple(); CollectionAssert.AreEquivalent(new[] { "Before", "After" }, log); }
public void ShouldResolveSameInstance() { var resolver = new DefaultServiceBusResolver(); var simpleImplementation = new SimpleImplementation(); resolver.Register<IContract>(simpleImplementation); var resultA = resolver.Resolve<IContract>(); var resultB = resolver.Resolve<IContract>(); Assert.That(resultA, Is.SameAs(simpleImplementation)); Assert.That(resultB, Is.SameAs(simpleImplementation)); }