예제 #1
0
        public void UnsafeRegisterUnityTest()
        {
            // Arrange
            var target = new TestRegistrar();

            DIContainer.Reset();

            // Act
            target.UnsafeRegister(
                null,
                null,
                false);

            // Assert
            Assert.IsTrue(DIContainer.IsInitialized);
            Assert.IsTrue(target.AreRegistered());
            Assert.IsTrue(target.RanRegistration);
            Assert.IsFalse(target.RanTestRegistration);
        }
예제 #2
0
        public void TestUnsafeRegisterTest()
        {
            // Arrange
            var target   = new TestRegistrar();
            var unityMoq = new Mock <IUnityContainer>();

            unityMoq.Setup(c => c.Registrations)
            .Returns(new List <ContainerRegistration>());

            // Act
            target.UnsafeRegister(
                unityMoq.Object,
                unityMoq.Object.GetRegistrationsSnapshot(),
                true);

            // Assert
            Assert.IsTrue(target.AreRegistered(unityMoq.Object));
            Assert.IsFalse(target.RanRegistration);
            Assert.IsTrue(target.RanTestRegistration);
        }