Exemplo n.º 1
0
        public void ReadDay_IndataIsNotDigit_ThrowException()
        {
            //Act
            Action action = () => DayReader.ReadDay("mo");

            //Assert
            action.Should().Throw <Exception>();
        }
Exemplo n.º 2
0
        public void ReadDay_IndataIsDigitWithWhiteSpace_ReturnsParsedDay()
        {
            //Act
            var day = DayReader.ReadDay(" 1 ");

            //Assert
            day.Should().Be(1);
        }
Exemplo n.º 3
0
        public void ReadDay_IndataIsEmpty_ThrowsArgumentException()
        {
            //Act
            Action action = () => DayReader.ReadDay(string.Empty);

            //Assert
            action.Should().Throw <ArgumentException>();
        }
Exemplo n.º 4
0
        public async Task DataParserTest(string input, string title, string summary, string content)
        {
            var receiverMock = new Mock <IDataReceiver>();

            receiverMock.Setup(receiver => receiver.CheckDayData(It.IsAny <int>(), It.IsAny <int>())).ReturnsAsync(true);
            receiverMock.Setup(receiver => receiver.ReceiveDayData(It.IsAny <int>(), It.IsAny <int>())).ReturnsAsync(input);
            var setting = Mock.Of <IAppSettings>(set => set.SummaryLength == 80);

            var dateTime = new DefaultDateTime();

            DayReader   reader      = new DayReader(receiverMock.Object, dateTime, setting);
            DayInfoData data        = (await reader.GetContent(1).ConfigureAwait(false));
            string      parseResult = (await reader.GetContent(1).ConfigureAwait(false))?.Title;

            Assert.Equal(title, data.Title);
            Assert.Equal(summary, data.Summary);
            Assert.Equal(content, data.Content);
        }