public void ReadDay_IndataIsNotDigit_ThrowException() { //Act Action action = () => DayReader.ReadDay("mo"); //Assert action.Should().Throw <Exception>(); }
public void ReadDay_IndataIsDigitWithWhiteSpace_ReturnsParsedDay() { //Act var day = DayReader.ReadDay(" 1 "); //Assert day.Should().Be(1); }
public void ReadDay_IndataIsEmpty_ThrowsArgumentException() { //Act Action action = () => DayReader.ReadDay(string.Empty); //Assert action.Should().Throw <ArgumentException>(); }
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); }