public async Task BothDimFormatsAreParsedCorrectly() { //Arrange var fileSystemMoq = new Mock <IFileSystem>(); fileSystemMoq.Setup(f => f.File.ReadAllLinesAsync(It.IsAny <string>(), It.IsAny <Encoding>(), default)) .Returns(() => Task.FromResult(EipWithTestData.Split(Environment.NewLine))); var logger = Mock.Of <ILogger>(); var eipReader = new EipReader(fileSystemMoq.Object, logger); //Act var products = (await eipReader.GetParsedEipContentsAsync("dummy.txt")).ToArray(); //Assert Assert.Equal(products[0].DimDateDateTime, products[1].DimDateDateTime); Assert.Equal(new DateTime(2021, 2, 22), products[0].DimDateDateTime); Assert.Equal(new DateTime(2021, 2, 22), products[1].DimDateDateTime); }
public async Task WhenXmlSerializing_OpenCloseTagsAreCreatedForEmptyFields() { //Arrange var fileSystemMoq = new Mock <IFileSystem>(); fileSystemMoq.Setup(f => f.File.ReadAllLinesAsync(It.IsAny <string>(), It.IsAny <Encoding>(), default)) .Returns(() => Task.FromResult(EipTestDataWithEmptyFields.Split(Environment.NewLine))); var logger = Mock.Of <ILogger>(); var eipReader = new EipReader(fileSystemMoq.Object, logger); var products = (await eipReader.GetParsedEipContentsAsync("dummy.txt")).ToArray(); var resultData = new I06Output(products.Select(p => new I07Output(p)).ToArray()); //Act var xmlString = resultData.XmlSerialize(); //Assert Assert.Contains("<DIM_01> </DIM_01>", xmlString); Assert.Contains("<I07_APRASYMAS1> </I07_APRASYMAS1>", xmlString); Assert.Contains("<I07_APRASYMAS2> </I07_APRASYMAS2>", xmlString); Assert.Contains("<I07_APRASYMAS3> </I07_APRASYMAS3>", xmlString); }