Example #1
0
        public void GetDisplayNameShouldReturnSpecifiedDisplayName()
        {
            var dataRowAttribute = new DataRowAttribute(null);

            dataRowAttribute.DisplayName = "DataRowTestWithDisplayName";

            this.dummyTestClass = new DummyTestClass();
            this.testMethodInfo = this.dummyTestClass.GetType().GetTypeInfo().GetDeclaredMethod("DataRowTestMethod");

            var data = new string[] { "First", "Second", null };

            var displayName = dataRowAttribute.GetDisplayName(this.testMethodInfo, data);

            Assert.AreEqual("DataRowTestWithDisplayName", displayName);
        }
Example #2
0
        public void GetDisplayNameShouldReturnAppropriateName()
        {
            var dataRowAttribute = new DataRowAttribute(null);

            this.dummyTestClass = new DummyTestClass();
            this.testMethodInfo = this.dummyTestClass.GetType().GetTypeInfo().GetDeclaredMethod("DataRowTestMethod");

            var data  = new string[] { "First", "Second", null };
            var data1 = new string[] { null, "First", "Second" };
            var data2 = new string[] { "First", null, "Second" };

            var displayName = dataRowAttribute.GetDisplayName(this.testMethodInfo, data);

            Assert.AreEqual("DataRowTestMethod (First,Second,)", displayName);

            displayName = dataRowAttribute.GetDisplayName(this.testMethodInfo, data1);
            Assert.AreEqual("DataRowTestMethod (,First,Second)", displayName);

            displayName = dataRowAttribute.GetDisplayName(this.testMethodInfo, data2);
            Assert.AreEqual("DataRowTestMethod (First,,Second)", displayName);
        }
Example #3
0
        public void GetDataShouldReturnDataPassed()
        {
            var dataRow = new DataRowAttribute("mercury");

            CollectionAssert.AreEqual(new object[] { "mercury" }, dataRow.GetData(null).FirstOrDefault());
        }
Example #4
0
        public void ConstructorShouldSetANullDataValuePassedInAsADataArg()
        {
            var dataRow = new DataRowAttribute(null, "logos");

            CollectionAssert.AreEqual(new object[] { null, "logos" }, dataRow.Data);
        }
Example #5
0
        public void ConstructorShouldSetANullDataValuePassedInParams()
        {
            var dataRow = new DataRowAttribute("neptune", null);

            CollectionAssert.AreEqual(new object[] { "neptune", null }, dataRow.Data);
        }
Example #6
0
        public void ConstructorShouldSetMultipleDataValuesPassed()
        {
            var dataRow = new DataRowAttribute("mercury", "venus", "earth");

            CollectionAssert.AreEqual(new object[] { "mercury", "venus", "earth" }, dataRow.Data);
        }
Example #7
0
        public void ConstructorShouldSetDataPassed()
        {
            var dataRow = new DataRowAttribute("mercury");

            CollectionAssert.AreEqual(new object[] { "mercury" }, dataRow.Data);
        }
Example #8
0
        public void DefaultConstructorSetsEmptyArrayPassed()
        {
            var dataRow = new DataRowAttribute();

            CollectionAssert.AreEqual(new object[] { }, dataRow.Data);
        }