Ejemplo n.º 1
0
        public async Task GetFileTextReturnsEmptyStringWhenFileDoesntExist()
        {
            var fileInfoHelper = A.Fake <IFileInfoHelper>();
            var service        = new ShellRobotFileService(fileInfoHelper);

            var result = await service.GetFileText("SomeRobotsPath").ConfigureAwait(false);

            Assert.True(string.IsNullOrWhiteSpace(result));
        }
Ejemplo n.º 2
0
        public async Task GetFileTextReturnsFilesTextWhenFileDoesntExist()
        {
            const string fakeRobotFileText = "FakeRobotFileText";
            var          fileInfoHelper    = A.Fake <IFileInfoHelper>();

            A.CallTo(() => fileInfoHelper.FileExists(A <string> .Ignored)).Returns(true);
            A.CallTo(() => fileInfoHelper.ReadAllTextAsync(A <string> .Ignored)).Returns(fakeRobotFileText);

            var service = new ShellRobotFileService(fileInfoHelper);

            var result = await service.GetFileText("SomeRobotsPath").ConfigureAwait(false);

            Assert.Equal(fakeRobotFileText, result);
        }