Exemplo n.º 1
0
        public void TestShouldHandleExternalStorageReinserted()
        {
            ExpectInternalSetup();
            ExpectExternalSetup();

            MockStatFsHelper statFsHelper = MockStatFsHelper.Instance;

            statFsHelper.SetExternalPath(null);
            statFsHelper.ResetStats();

            ulong freeBytes = statFsHelper.GetAvailableStorageSpace(StatFsHelper.StorageType.INTERNAL);

            Assert.IsTrue(INTERNAL_FREE_BYTES == freeBytes);

            freeBytes = statFsHelper.GetAvailableStorageSpace(StatFsHelper.StorageType.EXTERNAL);
            Assert.IsTrue(0 == freeBytes);

            statFsHelper.SetExternalPath(_externalPath);
            statFsHelper.SetExternalStatFs(EXTERNAL_FREE_BYTES);
            statFsHelper.ResetStats();

            freeBytes = statFsHelper.GetAvailableStorageSpace(StatFsHelper.StorageType.EXTERNAL);
            Assert.IsTrue(EXTERNAL_FREE_BYTES == freeBytes);

            statFsHelper.ResetStats();

            freeBytes = statFsHelper.GetAvailableStorageSpace(StatFsHelper.StorageType.EXTERNAL);
            Assert.IsTrue(EXTERNAL_FREE_BYTES == freeBytes);
        }
Exemplo n.º 2
0
        public void TestShouldCreateStatFsForInternalStorage()
        {
            ExpectInternalSetup();
            ExpectExternalSetup();

            MockStatFsHelper statFsHelper = MockStatFsHelper.Instance;

            ulong freeBytes = statFsHelper.GetAvailableStorageSpace(StatFsHelper.StorageType.INTERNAL);

            Assert.IsTrue(INTERNAL_FREE_BYTES == freeBytes);
        }
Exemplo n.º 3
0
        public void TestShouldHandleNoInternalStorage()
        {
            MockStatFsHelper statFsHelper = MockStatFsHelper.Instance;

            ulong freeBytes = statFsHelper.GetAvailableStorageSpace(StatFsHelper.StorageType.INTERNAL);

            Assert.IsTrue(0 == freeBytes);

            freeBytes = statFsHelper.GetAvailableStorageSpace(StatFsHelper.StorageType.EXTERNAL);
            Assert.IsTrue(0 == freeBytes);
        }