示例#1
0
        // c.f.: https://github.com/wgnf/ArrangeContext/issues/16
        public void Should_Work_With_Sealed_Dependencies()
        {
            var contextThatShouldFailBuild = new ArrangeContext <SystemUnderTestWithSealedDependency>();

            Assert.Throws <InstanceCreationFailedException>(() => contextThatShouldFailBuild.Build());

            var contextThatShouldFailFor = new ArrangeContext <SystemUnderTestWithSealedDependency>();

            Assert.Throws <InstanceCreationFailedException>(() => contextThatShouldFailFor.For <SealedDependency>());

            var contextThatShouldNotFail = new ArrangeContext <SystemUnderTestWithSealedDependency>();

            var newInstance = new SealedDependency();

            Assert.DoesNotThrow(() => contextThatShouldNotFail.Use(newInstance));

            var sut = contextThatShouldNotFail.Build();

            sut
            .Should()
            .NotBeNull();
        }
 public SystemUnderTestWithSealedDependency(
     // ReSharper disable once UnusedParameter.Local
     SealedDependency dependency)
 {
 }