Beispiel #1
0
 public void CompositionContainer_works_fine_when_explicitely_set()
 {
     var ambientServices = new AmbientServices();
     var mockContainer = Mock.Create<ICompositionContext>();
     mockContainer.Arrange(c => c.TryGetExport<ICompositionContext>(null)).Returns((ICompositionContext)null);
     ambientServices.RegisterService(mockContainer);
     var noService = ambientServices.CompositionContainer.TryGetExport<ICompositionContext>();
     Assert.IsNull(noService);
 }
Beispiel #2
0
 public void CompositionContainer_cannot_set_null()
 {
     var ambientServices = new AmbientServices();
     Assert.That(() => ambientServices.RegisterService<ICompositionContext>(null), Throws.InstanceOf<Exception>());
 }