Exemplo n.º 1
0
        public void Construction()
        {
            // arrange

            // act
            var converter = new RomanDecimalConverter();

            // assert
            Assert.NotNull(converter);
            Assert.Null(converter.RomanText);
            Assert.Null(converter.Decimal);
            Assert.Null(converter.ErrorMessage);
            Assert.Equal("none", converter.ErrorDisplay);
        }
Exemplo n.º 2
0
        public void ConvertBinary_WithDecimalString(
            string initialDecimal, string expectedRoman, string expectedErrorMessage, string expectedErrorDisplay)
        {
            // arrange
            var converter = new RomanDecimalConverter
            {
                Decimal = initialDecimal
            };

            // act
            converter.ConvertRoman();

            // assert
            Assert.Equal(expectedRoman, converter.RomanText);
            Assert.Equal(expectedErrorMessage, converter.ErrorMessage);
            Assert.Equal(expectedErrorDisplay, converter.ErrorDisplay);
        }
Exemplo n.º 3
0
        public void ConvertDecimal_WithRomanString(
            string initialRoman, string expectedDecimal, string expectedErrorMessage, string expectedErrorDisplay)
        {
            // arrange
            var converter = new RomanDecimalConverter
            {
                RomanText = initialRoman
            };

            // act
            converter.ConvertDecimal();

            // assert
            Assert.Equal(expectedDecimal, converter.Decimal);
            Assert.Equal(expectedErrorMessage, converter.ErrorMessage);
            Assert.Equal(expectedErrorDisplay, converter.ErrorDisplay);
        }
Exemplo n.º 4
0
        public void ConvertToRoman_Clicked()
        {
            // arrange
            using var ctx = new TestContext();
            var vm = new RomanDecimalConverter {
                Decimal = "7"
            };

            ctx.Services.AddSingleton <RomanDecimalConverter>(vm);

            var cut = ctx.RenderComponent <RomanDecimalConvert>();

            // act
            cut.Find("#btn-convert-roman").Click();

            // assert
            cut.MarkupMatches(RomanDecimalConvertExpectedResults.ConvertToRomanResult);
        }