Example #1
0
        public void CreateBcatSaveData_AlreadyExists_ReturnsPathAlreadyExists()
        {
            var applicationId   = new Ncm.ApplicationId(1);
            FileSystemClient fs = FileSystemServerFactory.CreateClient(true);

            Assert.Success(fs.CreateBcatSaveData(applicationId, 0x400000));
            Assert.Result(ResultFs.PathAlreadyExists, fs.CreateBcatSaveData(applicationId, 0x400000));
        }
Example #2
0
        public void MountBcatSaveData_SaveExists_ReturnsSuccess()
        {
            var applicationId   = new Ncm.ApplicationId(1);
            FileSystemClient fs = FileSystemServerFactory.CreateClient(true);

            Assert.Success(fs.CreateBcatSaveData(applicationId, 0x400000));
            Assert.Success(fs.MountBcatSaveData("bcat_test".ToU8Span(), applicationId));
        }
Example #3
0
        public void CreateBcatSaveData_DoesNotExist_SaveIsCreated()
        {
            var applicationId   = new Ncm.ApplicationId(1);
            FileSystemClient fs = FileSystemServerFactory.CreateClient(true);

            Assert.Success(fs.CreateBcatSaveData(applicationId, 0x400000));

            fs.OpenSaveDataIterator(out SaveDataIterator iterator, SaveDataSpaceId.User);

            var info = new SaveDataInfo[2];

            iterator.ReadSaveDataInfo(out long entriesRead, info);

            Assert.Equal(1, entriesRead);
            Assert.Equal(applicationId, info[0].ProgramId);
            Assert.Equal(SaveDataType.Bcat, info[0].Type);
        }
Example #4
0
        public void MountBcatSaveData_WrittenDataPersists()
        {
            var applicationId   = new Ncm.ApplicationId(1);
            FileSystemClient fs = FileSystemServerFactory.CreateClient(true);

            Assert.Success(fs.CreateBcatSaveData(applicationId, 0x400000));
            Assert.Success(fs.MountBcatSaveData("bcat_test".ToU8Span(), applicationId));

            // Check that the path doesn't exist
            Assert.Result(ResultFs.PathNotFound, fs.GetEntryType(out _, "bcat_test:/file".ToU8Span()));

            fs.CreateFile("bcat_test:/file".ToU8Span(), 0);
            fs.Commit("bcat_test".ToU8Span());
            fs.Unmount("bcat_test".ToU8Span());

            Assert.Success(fs.MountBcatSaveData("bcat_test".ToU8Span(), applicationId));
            Assert.Success(fs.GetEntryType(out DirectoryEntryType type, "bcat_test:/file".ToU8Span()));
            Assert.Equal(DirectoryEntryType.File, type);
        }