Beispiel #1
0
        public void DefaultPresenterFactory_GetBuildMethodInternal_ShouldThrowArgumentExcpetionWhenMatchingConstructorNotFound()
        {
            // Arrange
            var typeToBuild = typeof(GetBuildMethodInternal_TestClassWithParameter);

            // Act
            DefaultPresenterFactory.GetBuildMethodInternal(
                typeToBuild,
                typeof(int));

            // Assert
        }
        public void DefaultPresenterFactory_GetBuildMethodInternal_ShouldReturnWorkingBuildMethodForConstructorWithOneParameter()
        {
            // Arrange
            var typeToBuild = typeof(GetBuildMethodInternal_TestClassWithParameter);

            // Act
            var buildMethod = DefaultPresenterFactory.GetBuildMethodInternal(
                typeToBuild,
                typeof(string));
            var instance = buildMethod.Invoke(null, new object[] { "test" });

            // Assert
            Assert.IsInstanceOf(typeToBuild, instance);
            Assert.AreEqual("test", ((GetBuildMethodInternal_TestClassWithParameter)instance).Param);
        }