Example #1
0
        public async Task AsyncStreams_GetFileContentsOld_WhyThisIsCool()
        {
            //Arrange
            var asyncStreamsExample = new AsyncStreams();

            //Act
            var resultsOld = await asyncStreamsExample.GetFileContentsOld();

            var resultsNew = asyncStreamsExample.GetFileContentsNew();

            resultsOld.Any2(e => e == "Async");
            await DeferedLinq.Any3(resultsNew, e => e == "Async");
        }
Example #2
0
        public async Task AsyncStreams_GetFileContentsOld()
        {
            //Arrange
            var asyncStreamsExample = new AsyncStreams();

            //Act
            var linesNotDeffered = await asyncStreamsExample.GetFileContentsOld();

            var linesDeffered = asyncStreamsExample.GetFileContentsNew();

            var lines = new List <string>();

            await foreach (var line in linesDeffered)
            {
                lines.Add(line);
            }

            //Assert
            var oldWay = string.Join(" ", linesNotDeffered);
            var newWay = string.Join(" ", lines);

            Assert.Equal(oldWay, newWay);
        }