コード例 #1
0
        public void GetEnumDescription()
        {
            TestEnum opt   = TestEnum.Option1;
            string   check = opt.GetDescription();

            Assert.Equal("Option One", check);
        }
コード例 #2
0
        public void GetDescription_WithoutDescription()
        {
            // Arrange
            TestEnum item = TestEnum.Two;
            // Act
            string description = item.GetDescription();

            // Assert
            Assert.AreEqual("Two", description);
        }
コード例 #3
0
        public void GetDescription_WithDescription()
        {
            // Arrange
            TestEnum item = TestEnum.One;
            // Act
            string description = item.GetDescription();

            // Assert
            Assert.AreEqual(TestEnumOneDescription, description);
        }
コード例 #4
0
        public void GetDescription_DefinedValue_ReturnsDescription(TestEnum value, string expectedResult)
        {
            // Act

            var result = value.GetDescription();

            // Assert

            Assert.Equal(expectedResult, result);
        }
コード例 #5
0
        public void GetDescription_GivenEnumValue_ReturnsDescription(TestEnum testEnum, string expectedDescription)
        {
            //Act
            string description = testEnum.GetDescription();

            //Assert
            description
            .Should()
            .Be(expectedDescription);
        }
コード例 #6
0
        public void GetDescription_TestEnum_SecondElement_NET452()
        {
            // Arrange
            TestEnum enumToTest = TestEnum.SecondElement;

            // Act
            string actualResults = enumToTest.GetDescription();

            // Assert
            Assert.AreEqual("SecondElementDescription", actualResults);
        }
コード例 #7
0
        public void GetDescription_TestEnum_ThirdElement_NETCOREAPP1_1()
        {
            // Arrange
            TestEnum enumToTest = TestEnum.ThirdElement;

            // Act
            string actualResults = enumToTest.GetDescription();

            // Assert
            Assert.AreEqual("ThirdElement", actualResults);
        }
コード例 #8
0
        public void GetDescription_ReturnsCorrectDescriptionCase2()
        {
            // Arrange
            TestEnum enumValue           = TestEnum.First;
            string   expectedDescription = "Something";

            // Act
            string actualDescription = enumValue.GetDescription();

            // Assert
            Assert.AreEqual(expectedDescription, actualDescription);
        }
コード例 #9
0
        public void GetDescription_GivenEnumValueThatHasNoAttribute_ReturnsEnumName()
        {
            //Arrange
            TestEnum testEnum = TestEnum.Red;

            //Act
            string description = testEnum.GetDescription();

            //Assert
            description
            .Should()
            .Be("Red");
        }
コード例 #10
0
        public void GetDescription_GivenEnumValue_ReturnsDescription()
        {
            //Arrange
            TestEnum testEnum = TestEnum.Green;

            //Act
            string description = testEnum.GetDescription();

            //Assert
            description
            .Should()
            .Be("green");
        }
コード例 #11
0
        public void GetDescription_GivenEnumValueThatHasNoAttributeAndNameIfNullIsFalse_ReturnsEmptyString()
        {
            //Arrange
            TestEnum testEnum = TestEnum.Red;

            //Act
            string description = testEnum.GetDescription(false);

            //Assert
            description
            .Should()
            .BeEmpty();
        }
コード例 #12
0
 public void GetDescription(TestEnum testEnum, string descriptionExpected)
 {
     Assert.Equal(descriptionExpected, testEnum.GetDescription());
 }
コード例 #13
0
 public void GetDescriptionGetsValueOfDescriptionAttributeOrValueNameIfNoDescriptionAttributeExists(TestEnum enumValue, string expectedDescription)
 {
     var actualDescription = enumValue.GetDescription();
     Assert.AreEqual(expectedDescription, actualDescription);
 }
コード例 #14
0
        public void GetDescriptionExtensionMethod_ShouldReturnExpectedValue_IfInputValueHasDescription(TestEnum input, string expected)
        {
            string result = input.GetDescription();

            Assert.AreEqual(result, expected);
        }
コード例 #15
0
        public void HLEnumTests_providedEnumDescription_shouldBeValid(TestEnum val, string expectedOutput)
        {
            string actualOutput = val.GetDescription();

            Assert.AreEqual(actualOutput, expectedOutput);
        }
コード例 #16
0
 //TODO Checar o funcionamento do localized description
 //[InlineData("This is a Localized Description", TestEnum.SixthItem)]
 public void MustGetDescription(string expected, TestEnum value)
 {
     value.GetDescription().ShouldBe(expected);
 }
コード例 #17
0
ファイル: EnumExtensionsTests.cs プロジェクト: wushian/Vanara
 public void GetDescriptionTest()
 {
     Assert.That(TestEnum.Value1.GetDescription(), Is.EqualTo("My first value."));
     Assert.That(TestEnum.Value2.GetDescription(), Is.EqualTo("Value2"));
     Assert.That(test.GetDescription(), Is.EqualTo("Value1, Value2"));
 }
コード例 #18
0
 public void TestGetDescription(TestEnum enumValue, string expected)
 {
     Assert.That(enumValue.GetDescription(), Is.EqualTo(expected));
 }