コード例 #1
0
        public void GameLocation(
            Utility.Return r,
            ProfileDataFolderVm sut)
        {
            sut.FileSystem.Directory.Exists(Arg.Any <string>()).Returns(true);
            sut.GameLocator.TryGet(Arg.Any <GameRelease>(), out Arg.Any <DirectoryPath>())
            .Returns(x =>
            {
                switch (r)
                {
                case Utility.Return.False:
                    return(false);

                case Utility.Return.True:
                    x[1] = new DirectoryPath("Something");
                    return(true);

                default:
                    throw new Exception();
                }
            });
            sut.DataFolderResult.Succeeded.Should().Be(r == Utility.Return.True);
            if (r == Utility.Return.True)
            {
                sut.Path.Path.Should().NotBeNullOrWhiteSpace();
            }
            else
            {
                sut.Path.Path.Should().BeNullOrWhiteSpace();
            }
        }
コード例 #2
0
        public void WatchesForFileExistence(
            Utility.Return r,
            DirectoryPath folder,
            [Frozen] IFileSystem fs,
            [Frozen] IProfileIdentifier ident,
            [Frozen] IGameDirectoryLookup lookup,
            Func <ProfileDataFolderVm> sutF)
        {
            lookup.TryGet(ident.Release, out Arg.Any <DirectoryPath>())
            .Returns(x =>
            {
                x[1] = folder;
                return(true);
            });
            var dataFolder = Path.Combine(folder.Path, "Data");

            fs.Directory.Exists(dataFolder).Returns(r);
            var sut = sutF();

            sut.DataFolderResult.Succeeded.Should().Be(r == Utility.Return.True);
            if (r == Utility.Return.True)
            {
                sut.DataFolderResult.Value.Path.Should().Be(dataFolder);
                sut.Path.Path.Should().NotBeNullOrWhiteSpace();
            }
            else
            {
                sut.Path.Path.Should().BeNullOrWhiteSpace();
            }
        }
コード例 #3
0
        public async Task HasDataPathOverride(
            Utility.Return r,
            DirectoryPath folder,
            ProfileDataFolderVm sut)
        {
            sut.FileSystem.Directory.Exists(folder.Path).Returns(r);
            sut.DataPathOverride = folder;

            sut.DataFolderResult.Succeeded.Should().Be(r == Utility.Return.True);
            if (r == Utility.Return.True)
            {
                sut.DataFolderResult.Value.Should().Be(folder);
                sut.Path.Path.Should().NotBeNullOrWhiteSpace();
            }
            else
            {
                sut.Path.Path.Should().BeNullOrWhiteSpace();
            }
        }