Lookup of IBuilderData organized as a dictionary of strings, categorized into main categories.
Inheritance: IBuildDataDictionary
Example #1
0
        /*/// <summary>
         * /// Initializes a new instance of the <see cref="TestObjectCreator"/> class.
         * /// </summary>
         * internal TestObjectCreator() { }*/
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="TestObjectComposer"/> class.
        /// </summary>
        /// <param name="buildData">The build data dictionary.</param>
        /// <param name="setUpMethod">The SetUpMethod</param>
        /// <param name="testObjectMemberField">The TestObjectMemberField</param>
        /// <param name="testObjectName">The TestObjectName</param>
        /// <param name="testObjectType">Type of the test object.</param>
        internal TestObjectComposer(
            BuildDataDictionary buildData,
            CodeMemberMethod setUpMethod,
            CodeMemberField testObjectMemberField,
            string testObjectName,
            Type testObjectType)
            : base(buildData, setUpMethod, testObjectMemberField, testObjectName, testObjectType)
        {
        }
Example #2
0
 public void SetUp()
 {
     this.codeNamespace        = new System.CodeDom.CodeNamespace();
     this.testClassDeclaration = new System.CodeDom.CodeTypeDeclaration();
     this.typeMember           = new System.CodeDom.CodeTypeMember();
     this.buildData            = new NStub.CSharp.ObjectGeneration.BuildDataDictionary();
     this.mocks       = new MockRepository();
     this.builderData = this.mocks.StrictMock <IBuilderData>();
     this.buildData.AddDataItem("CAT", "TheKey", builderData);
     this.setUpTearDownContext = this.mocks.StrictMock <NStub.CSharp.BuildContext.ISetupAndTearDownContext>();
     this.testObject           = this.mocks.Stub <MemberBuildContextBase>(this.codeNamespace, this.testClassDeclaration, this.typeMember, this.buildData, this.setUpTearDownContext);
 }
Example #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)
 {
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SetupAndTearDownContext"/> class.
 /// </summary>
 /// <param name="buildData">The build data dictionary.</param>
 /// <param name="codeNamespace">The code namespace of the test.</param>
 /// <param name="testClassDeclaration">The test class declaration.( early testObject ).</param>
 /// <param name="setUpMethod">A reference to the test setup method.</param>
 /// <param name="tearDownMethod">The tear down method.</param>
 /// <param name="creator">The test object member field generator of the test SetUp method.</param>
 public SetupAndTearDownContext(
     BuildDataDictionary buildData,
     CodeNamespace codeNamespace,
     CodeTypeDeclaration testClassDeclaration,
     CodeMemberMethod setUpMethod,
     CodeMemberMethod tearDownMethod,
     ITestObjectComposer creator)
     : base(buildData, 
         codeNamespace, 
         testClassDeclaration, 
         setUpMethod, 
         tearDownMethod, 
         creator)
 {
 }
Example #5
0
        public void ConstructWithParametersBuildDataSetUpMethodTestObjectMemberFieldTestObjectNameTestObjectTypeTest()
        {
            this.buildData             = new NStub.CSharp.ObjectGeneration.BuildDataDictionary();
            this.setUpMethod           = new System.CodeDom.CodeMemberMethod();
            this.testObjectMemberField = new System.CodeDom.CodeMemberField();
            this.testObjectName        = "myTestObjectName";
            this.testObjectType        = typeof(object);
            this.testObject            = new TestObjectComposer(this.buildData, this.setUpMethod, this.testObjectMemberField, this.testObjectName, this.testObjectType);

            Assert.Throws <ArgumentNullException>(() => new TestObjectComposer(null, this.setUpMethod, this.testObjectMemberField, this.testObjectName, this.testObjectType));
            Assert.Throws <ArgumentNullException>(() => new TestObjectComposer(this.buildData, null, this.testObjectMemberField, this.testObjectName, this.testObjectType));
            Assert.Throws <ArgumentNullException>(() => new TestObjectComposer(this.buildData, this.setUpMethod, null, this.testObjectName, this.testObjectType));
            Assert.Throws <ArgumentNullException>(() => new TestObjectComposer(this.buildData, this.setUpMethod, this.testObjectMemberField, null, this.testObjectType));
            Assert.Throws <ArgumentException>(() => new TestObjectComposer(this.buildData, this.setUpMethod, this.testObjectMemberField, string.Empty, this.testObjectType));
            Assert.Throws <ArgumentNullException>(() => new TestObjectComposer(this.buildData, this.setUpMethod, this.testObjectMemberField, this.testObjectName, null));
        }
Example #6
0
        public void ConstructWithParametersBuildDataSetUpMethodTestObjectMemberFieldTestObjectNameTestObjectTypeTest()
        {
            this.buildData = new NStub.CSharp.ObjectGeneration.BuildDataDictionary();
            this.setUpMethod = new System.CodeDom.CodeMemberMethod();
            this.testObjectMemberField = new System.CodeDom.CodeMemberField();
            this.testObjectName = "myTestObjectName";
            this.testObjectType = typeof(object);
            this.testObject = new TestObjectComposer(this.buildData, this.setUpMethod, this.testObjectMemberField, this.testObjectName, this.testObjectType);

            Assert.Throws<ArgumentNullException>(() => new TestObjectComposer(null, this.setUpMethod, this.testObjectMemberField, this.testObjectName, this.testObjectType));
            Assert.Throws<ArgumentNullException>(() => new TestObjectComposer(this.buildData, null, this.testObjectMemberField, this.testObjectName, this.testObjectType));
            Assert.Throws<ArgumentNullException>(() => new TestObjectComposer(this.buildData, this.setUpMethod, null, this.testObjectName, this.testObjectType));
            Assert.Throws<ArgumentNullException>(() => new TestObjectComposer(this.buildData, this.setUpMethod, this.testObjectMemberField, null, this.testObjectType));
            Assert.Throws<ArgumentException>(() => new TestObjectComposer(this.buildData, this.setUpMethod, this.testObjectMemberField, string.Empty, this.testObjectType));
            Assert.Throws<ArgumentNullException>(() => new TestObjectComposer(this.buildData, this.setUpMethod, this.testObjectMemberField, this.testObjectName, null));
        }
Example #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestObjectComposerBase"/> class.
        /// </summary>
        /// <param name="buildData">The build data dictionary.</param>
        /// <param name="setUpMethod">The method where the test object is initialized</param>
        /// <param name="testObjectMemberField">The member field creation expression for the object under test.</param>
        /// <param name="testObjectName">The name of the test object.</param>
        /// <param name="testObjectType">Type of the test object.</param>
        protected TestObjectComposerBase(
            BuildDataDictionary buildData,
            CodeMemberMethod setUpMethod,
            CodeMemberField testObjectMemberField,
            string testObjectName,
            Type testObjectType)
        {
            Guard.NotNull(() => buildData, buildData);
            Guard.NotNull(() => setUpMethod, setUpMethod);
            Guard.NotNull(() => testObjectMemberField, testObjectMemberField);
            Guard.NotNullOrEmpty(() => testObjectName, testObjectName);
            Guard.NotNull(() => testObjectType, testObjectType);

            this.BuildData             = buildData;
            this.SetUpMethod           = setUpMethod;
            this.TestObjectMemberField = testObjectMemberField;
            this.TestObjectName        = testObjectName;
            this.TestObjectType        = testObjectType;
        }
Example #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestObjectComposerBase"/> class.
        /// </summary>
        /// <param name="buildData">The build data dictionary.</param>
        /// <param name="setUpMethod">The method where the test object is initialized</param>
        /// <param name="testObjectMemberField">The member field creation expression for the object under test.</param>
        /// <param name="testObjectName">The name of the test object.</param>
        /// <param name="testObjectType">Type of the test object.</param>
        protected TestObjectComposerBase(
            BuildDataDictionary buildData,
            CodeMemberMethod setUpMethod,
            CodeMemberField testObjectMemberField,
            string testObjectName,
            Type testObjectType)
        {
            Guard.NotNull(() => buildData, buildData);
            Guard.NotNull(() => setUpMethod, setUpMethod);
            Guard.NotNull(() => testObjectMemberField, testObjectMemberField);
            Guard.NotNullOrEmpty(() => testObjectName, testObjectName);
            Guard.NotNull(() => testObjectType, testObjectType);

            this.BuildData = buildData;
            this.SetUpMethod = setUpMethod;
            this.TestObjectMemberField = testObjectMemberField;
            this.TestObjectName = testObjectName;
            this.TestObjectType = testObjectType;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SetupAndTearDownContextBase"/> class.
        /// </summary>
        /// <param name="buildData">The build data dictionary.</param>
        /// <param name="codeNamespace">The code namespace.</param>
        /// <param name="testClassDeclaration">The test class declaration.( early testObject ).</param>
        /// <param name="setUpMethod">A reference to the test setup method.</param>
        /// <param name="tearDownMethod">The tear down method.</param>
        /// <param name="creator">The test object member field generator of the test SetUp method.</param>
        protected SetupAndTearDownContextBase(
            BuildDataDictionary buildData,
            CodeNamespace codeNamespace,
            CodeTypeDeclaration testClassDeclaration,
            CodeMemberMethod setUpMethod,
            CodeMemberMethod tearDownMethod,
            ITestObjectComposer creator)
        {
            Guard.NotNull(() => buildData, buildData);
            Guard.NotNull(() => codeNamespace, codeNamespace);
            Guard.NotNull(() => testClassDeclaration, testClassDeclaration);
            Guard.NotNull(() => setUpMethod, setUpMethod);
            Guard.NotNull(() => tearDownMethod, tearDownMethod);
            Guard.NotNull(() => creator, creator);

            this.BuildData = buildData;
            this.CodeNamespace = codeNamespace;
            this.TestClassDeclaration = testClassDeclaration;
            this.SetUpMethod = setUpMethod;
            this.TearDownMethod = tearDownMethod;
            this.TestObjectCreator = creator;
        }
 public void SetUp()
 {
     this.codeNamespace = new System.CodeDom.CodeNamespace();
     this.testClassDeclaration = new System.CodeDom.CodeTypeDeclaration();
     this.typeMember = new System.CodeDom.CodeTypeMember();
     this.buildData = new NStub.CSharp.ObjectGeneration.BuildDataDictionary();
     this.mocks = new MockRepository();
     this.builderData = this.mocks.StrictMock<IBuilderData>();
     this.buildData.AddDataItem("CAT", "TheKey", builderData);
     this.setUpTearDownContext = this.mocks.StrictMock<NStub.CSharp.BuildContext.ISetupAndTearDownContext>();
     this.testObject = this.mocks.Stub<MemberBuildContextBase>(this.codeNamespace, this.testClassDeclaration, this.typeMember, this.buildData, this.setUpTearDownContext);
 }
Example #11
0
        /// <summary>
        /// Gets the xml data representation of multiple registered <see cref="IMultiBuilder"/>s parameters by key.
        /// </summary>
        /// <param name="key">The unique id of the multi parameter item.</param>
        /// <param name="builderType">Type of the builder to request a set of sample data for.</param>
        /// <param name="properties">The properties storage which stores the <see cref="IMultiBuildParameters"/> data to serialize.</param>
        /// <returns>
        /// The serialized data of the specified <paramref name="builderType"/>.
        /// </returns>
        public string SerializeSetupData(Guid key, Type builderType, BuildDataDictionary properties)
        {
            var setupPara = this.GetMultiParameter(key, builderType, properties);

            return(this.serializer.SerializeParametersForBuilderType(builderType, setupPara));
        }
Example #12
0
 public void TearDown()
 {
     this.testObject = null;
 }
Example #13
0
 public void SetUp()
 {
     this.testObject = new BuildDataDictionary();
     this.item1 = new EmptyMultiBuildParameters() { Enabled = true };
     this.item2 = new EmptyMultiBuildParameters() { Id = new Guid("2764B5BE-6E56-4694-B1A1-5C105420CB7F") };
     this.item3 = new EmptyMultiBuildParameters() { Enabled = true, Id = new Guid("0AE4E28A-9B78-43bf-ABD2-9F7CB5F3833B") };
 }
Example #14
0
        public void PropertyIsDirtyNormalBehavior()
        {
            // Test read access of 'IsDirty' Property.
            var expected = false;
            var actual = testObject.IsDirty;
            Assert.AreEqual(expected, actual);

            testObject.AddDataItem("Moo", "Key", item1);
            expected = true;
            actual = testObject.IsDirty;
            Assert.AreEqual(expected, actual);

            this.testObject = new BuildDataDictionary();
            testObject.AddDataItem("YesInGeneral", item2);
            actual = testObject.IsDirty;
            Assert.AreEqual(expected, actual);

            this.testObject = new BuildDataDictionary();
            testObject.AddDataItem("NotInGeneral", "My-Key", item3);
            actual = testObject.IsDirty;
            Assert.AreEqual(expected, actual);

            testObject.Save();
            expected = false;
            actual = testObject.IsDirty;
            Assert.AreEqual(expected, actual);

            // replacing the existing from above should not affect the dirty flag.
            testObject.AddDataItem("NotInGeneral", "My-Key", item3, true);
            actual = testObject.IsDirty;
            Assert.AreEqual(expected, actual);

            testObject.AddDataItem("NotInGeneral", "My-OtherKey", item3, true);
            expected = true;
            actual = testObject.IsDirty;
            Assert.AreEqual(expected, actual);
        }
Example #15
0
 public void ConstructTest()
 {
     this.testObject = new BuildDataDictionary();
     // unit test for Empty list. Always has the 'General' category.
     Assert.AreEqual(1, testObject.Count);
     Assert.IsNotEmpty(testObject);
     var lookup = testObject["General"];
     Assert.IsNotNull(lookup);
 }
        public void SetUp()
        {
            this.mocks = new MockRepository();

            buildData = new BuildDataDictionary();
            codeNamespace = new CodeNamespace();
            testClassDeclaration = new CodeTypeDeclaration();
            setUpMethod = new CodeMemberMethod();
            tearDownMethod = new CodeMemberMethod();
            creator = this.mocks.StrictMock<ITestObjectComposer>();

            this.testObject = this.mocks.StrictMock<SetupAndTearDownContextBase>(buildData, codeNamespace,
                testClassDeclaration, setUpMethod, tearDownMethod, creator);
        }
Example #17
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);
        }
Example #18
0
 public void ConstructWithParametersCodeNamespaceTestClassDeclarationTypeMemberBuildDataSetUpTearDownContextTest(
     )
 {
     // TODO: Implement unit test for ConstructWithParametersCodeNamespaceTestClassDeclarationTypeMemberBuildDataSetUpTearDownContext
     this.codeNamespace = new CodeNamespace();
     this.testClassDeclaration = new CodeTypeDeclaration();
     this.typeMember = new CodeTypeMember();
     this.buildData = new BuildDataDictionary();
     this.testObject = new MemberBuildContext(
         this.codeNamespace,
         this.testClassDeclaration,
         this.typeMember,
         this.buildData,
         this.setUpTearDownContext, TheKey);
 }
Example #19
0
 private void SetupInstance()
 {
     BuildProperties = new BuildDataDictionary();
     Memberfactory = MemberBuilderFactory.Default;
 }