Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }