public void GetServiceReturnsNullWhenServiceIsNotAvailable() { using (var transformation = new FakeTransformation()) using (var context = new TransformationContext(transformation, transformation.GenerationEnvironment)) { Assert.IsNull(context.GetService(typeof(ICloneable))); // Bogus service } }
public void GetServiceDelegatesToHost() { using (var transformation = new FakeTransformation()) using (var context = new TransformationContext(transformation, transformation.GenerationEnvironment)) { var expected = ((IServiceProvider)transformation.Host).GetService(typeof(ITransformationContextProvider)); var actual = context.GetService(typeof(ITransformationContextProvider)); Assert.AreSame(expected, actual); } }