Ejemplo n.º 1
0
        public void GetConstructorWithNoDelegates()
        {
            // Arrange
              var cc = new CompositeConstructorChooser(/* no delegates */);

              // Act
              Action execution = () => cc.GetConstructor(typeof (A));

              // Assert
              execution.ShouldThrow<NukitoException>()
            .WithMessage("Could not find an applicable constructor for type Nukito.Test.Scenario.A",
                     ComparisonMode.Substring);
        }
Ejemplo n.º 2
0
        public void GetConstructorShouldReturnFirstNonNull(Mock<IConstructorChooser> cc1, [Ctx ("other")] Mock<IConstructorChooser> cc2)
        {
            // Arrange
              var cc = new CompositeConstructorChooser (cc1.Object, cc2.Object);
              ConstructorInfo constructorInfo = typeof (A).GetConstructors().Single();
              cc1.Setup(x => x.GetConstructor(typeof (A))).Returns(constructorInfo);

              // Act
              ConstructorInfo result = cc.GetConstructor(typeof (A));

              // Assert
              result.Should().BeSameAs(constructorInfo);
              cc2.Verify(x => x.GetConstructor(typeof (A)), Times.Never());
        }