Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MemberBuildContextBase"/> class.
        /// </summary>
        /// <param name="codeNamespace">The code namespace.</param>
        /// <param name="testClassDeclaration">The test class declaration.( early testObject ).</param>
        /// <param name="typeMember">The current type to create a test method for.</param>
        /// <param name="buildData">The additional build data lookup.</param>
        /// <param name="setUpTearDownContext">Contains data specific to SetUp and TearDown test-methods.</param>
        /// <param name="baseKey">The base string of the <see cref="TestKey"/>. Is amended by the
        /// <paramref name="codeNamespace"/> identifier, normalized and fixed by a <see cref="KeynameFixer"/>.</param>
        protected MemberBuildContextBase(
            CodeNamespace codeNamespace,
            CodeTypeDeclaration testClassDeclaration,
            CodeTypeMember typeMember,
            BuildDataDictionary buildData,
            ISetupAndTearDownContext setUpTearDownContext,
            string baseKey)
        {
            Guard.NotNull(() => codeNamespace, codeNamespace);
            Guard.NotNull(() => testClassDeclaration, testClassDeclaration);
            Guard.NotNull(() => typeMember, typeMember);
            Guard.NotNull(() => buildData, buildData);
            Guard.NotNull(() => setUpTearDownContext, setUpTearDownContext);
            Guard.NotNullOrEmpty(() => baseKey, baseKey);

            this.CodeNamespace        = codeNamespace;
            this.TestClassDeclaration = testClassDeclaration;
            this.TypeMember           = typeMember;
            this.BuildData            = buildData;
            this.SetUpTearDownContext = setUpTearDownContext;

            this.PreBuildResult = new MemberBuildResult();
            this.BuildResult    = new MemberBuildResult();

            //this.TestKey = GetTestKey(codeNamespace, testClassDeclaration, typeMember);
            var fixer     = new KeynameFixer(codeNamespace, testClassDeclaration, typeMember);
            var fixedName = fixer.Fix(typeMember.Name);

            this.TestKey = baseKey + "." + fixedName;
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MemberBuildContext"/> class.
 /// </summary>
 /// <param name="codeNamespace">The code namespace of the test.</param>
 /// <param name="testClassDeclaration">The test class declaration.( early testObject ).</param>
 /// <param name="typeMember">The current type to create a test method for.</param>
 /// <param name="buildData">The additional build data lookup.</param>
 /// <param name="setUpTearDownContext">Contains data specific to SetUp and TearDown test-methods.</param>
 /// <param name="baseKey">The base string of the <see cref="MemberBuildContextBase.TestKey"/>. Is amended by the
 /// <paramref name="codeNamespace"/> identifier, normalized and fixed by a <see cref="KeynameFixer"/>.</param>
 public MemberBuildContext(
     CodeNamespace codeNamespace,
     CodeTypeDeclaration testClassDeclaration,
     CodeTypeMember typeMember,
     BuildDataDictionary buildData,
     ISetupAndTearDownContext setUpTearDownContext,
     string baseKey)
     : base(codeNamespace,
         testClassDeclaration,
         typeMember,
         buildData,
         setUpTearDownContext,
         baseKey)
 {
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MemberBuildContext"/> class.
 /// </summary>
 /// <param name="codeNamespace">The code namespace of the test.</param>
 /// <param name="testClassDeclaration">The test class declaration.( early testObject ).</param>
 /// <param name="typeMember">The current type to create a test method for.</param>
 /// <param name="buildData">The additional build data lookup.</param>
 /// <param name="setUpTearDownContext">Contains data specific to SetUp and TearDown test-methods.</param>
 /// <param name="baseKey">The base string of the <see cref="MemberBuildContextBase.TestKey"/>. Is amended by the
 /// <paramref name="codeNamespace"/> identifier, normalized and fixed by a <see cref="KeynameFixer"/>.</param>
 public MemberBuildContext(
     CodeNamespace codeNamespace,
     CodeTypeDeclaration testClassDeclaration,
     CodeTypeMember typeMember,
     BuildDataDictionary buildData,
     ISetupAndTearDownContext setUpTearDownContext,
     string baseKey)
     : base(
         codeNamespace,
         testClassDeclaration,
         typeMember,
         buildData,
         setUpTearDownContext,
         baseKey)
 {
 }
Beispiel #4
0
        public void SetUp()
        {
            this.codeNamespace        = new CodeNamespace();
            this.testClassDeclaration = new CodeTypeDeclaration();
            this.typeMember           = new CodeTypeMember();

            // MethodInfo methodInfo = this.GetType().GetMethod("SetUp");
            // typeMember.UserData[NStubConstants.TestMemberMethodInfoKey] = methodInfo;
            this.buildData            = new BuildDataDictionary();
            this.mocks                = new MockRepository();
            this.setUpTearDownContext = this.mocks.StrictMock <ISetupAndTearDownContext>();
            this.testObject           = new MemberBuildContext(
                this.codeNamespace,
                this.testClassDeclaration,
                this.typeMember,
                this.buildData,
                this.setUpTearDownContext, TheKey);
        }
Beispiel #5
0
        public void SetUp()
        {
            this.codeNamespace = new CodeNamespace();
            this.testClassDeclaration = new CodeTypeDeclaration();
            this.typeMember = new CodeTypeMember();

            // MethodInfo methodInfo = this.GetType().GetMethod("SetUp");
            // typeMember.UserData[NStubConstants.TestMemberMethodInfoKey] = methodInfo;
            this.buildData = new BuildDataDictionary();
            this.mocks = new MockRepository();
            this.setUpTearDownContext = this.mocks.StrictMock<ISetupAndTearDownContext>();
            this.testObject = new MemberBuildContext(
                this.codeNamespace,
                this.testClassDeclaration,
                this.typeMember,
                this.buildData,
                this.setUpTearDownContext, TheKey);
        }