Example #1
0
        protected override void GivenThat()
        {
            base.GivenThat();

            PortableDeviceHelper.Stub(
                helper => helper.GetChildObjectIds(PortableDeviceContent, PortableDeviceConstants.WPD_DEVICE_OBJECT_ID))
            .Return(new[] { "InternalStorageID" });

            PortableDeviceHelper.Stub(
                helper => helper.GetChildObjectIds(PortableDeviceContent, "InternalStorageID"))
            .Return(new[] { "fooId", "xId" });

            PortableDeviceHelper
            .Stub(propertyHelper => propertyHelper.GetObjectFileName(
                      PortableDeviceContent,
                      "InternalStorageID"))
            .Return("Internal Storage");

            PortableDeviceHelper
            .Stub(propertyHelper => propertyHelper.GetObjectFileName(
                      PortableDeviceContent,
                      "xId"))
            .Return("x");

            PortableDeviceHelper
            .Stub(propertyHelper => propertyHelper.GetObjectFileName(
                      PortableDeviceContent,
                      "fooId"))
            .Return("foo.mp3");

            UnderlyingStream = GenerateMock <IStream>();

            DeviceStream = GeneratePartialMock <Stream>();
        }
Example #2
0
        protected override void GivenThat()
        {
            base.GivenThat();

            PortableDeviceHelper.Stub(
                helper => helper.GetChildObjectIds(PortableDeviceContent, PortableDeviceConstants.WPD_DEVICE_OBJECT_ID))
            .Return(new[] { "Dummy1", "InternalStorageID", "Dummy2" });

            PortableDeviceHelper.Stub(
                helper => helper.GetChildObjectIds(PortableDeviceContent, "InternalStorageID"))
            .Return(new[] { "Dummy3", "Dummy4", "fooId" });

            PortableDeviceHelper.Stub(
                helper => helper.GetChildObjectIds(PortableDeviceContent, "fooId"))
            .Return(new[] { "Dummy5", "Dummy6", "barId" });

            PortableDeviceHelper
            .Stub(propertyHelper => propertyHelper.GetObjectFileName(
                      PortableDeviceContent,
                      "InternalStorageID"))
            .Return("Internal Storage");

            PortableDeviceHelper
            .Stub(propertyHelper => propertyHelper.GetObjectFileName(
                      PortableDeviceContent,
                      "fooId"))
            .Return("foo");

            PortableDeviceHelper
            .Stub(propertyHelper => propertyHelper.GetObjectFileName(
                      PortableDeviceContent,
                      "barId"))
            .Return("bar");
        }
        protected override void GivenThat()
        {
            base.GivenThat();

            PortableDeviceHelper.Stub(
                helper => helper.GetChildObjectIds(PortableDeviceContent, PortableDeviceConstants.WPD_DEVICE_OBJECT_ID))
            .Return(new[] { "Dummy1", "xId", "Dummy2" });

            PortableDeviceHelper.Stub(
                helper => helper.GetChildObjectIds(PortableDeviceContent, "xId"))
            .Return(new[] { "Dummy3", "yId", "Dummy4" });

            PortableDeviceHelper.Stub(
                helper => helper.GetChildObjectIds(PortableDeviceContent, "yId"))
            .Return(new[] { "Dummy5", "InternalStorageId", "Dummy6" });

            StubObjectFilenameAndContentType("xId", "x", PortableDeviceConstants.WPD_CONTENT_TYPE_FOLDER);
            StubObjectFilenameAndContentType("yId", "y", PortableDeviceConstants.WPD_CONTENT_TYPE_FOLDER);
            StubObjectFilenameAndContentType("InternalStorageId", "Internal Storage", PortableDeviceConstants.WPD_CONTENT_TYPE_FUNCTIONAL_OBJECT);

            PortableDeviceHelper.Stub(
                propertyHelper => propertyHelper.GetGuidProperty(
                    PortableDeviceContent,
                    "InternalStorageId",
                    PortableDevicePropertyKeys.WPD_FUNCTIONAL_OBJECT_CATEGORY))
            .Return(PortableDeviceConstants.WPD_FUNCTIONAL_CATEGORY_STORAGE);
        }
Example #4
0
        protected override void GivenThat()
        {
            base.GivenThat();

            PortableDeviceHelper
            .Stub(propertyHelper => propertyHelper.GetObjectFileName(
                      PortableDeviceContent,
                      PortableDeviceConstants.WPD_DEVICE_OBJECT_ID))
            .Return("The device name");
        }
Example #5
0
        protected override void GivenThat()
        {
            base.GivenThat();

            PortableDeviceHelper.Stub(
                helper => helper.OpenResourceStream(PortableDeviceContent, "fooId", StreamConstants.STGM_READ))
            .Return(UnderlyingStream);

            DeviceStreamFactory.Stub(factory => factory.CreateStream(UnderlyingStream))
            .Return(DeviceStream);
        }
Example #6
0
        protected override void GivenThat()
        {
            base.GivenThat();

            PortableDeviceHelper.Stub(
                helper => helper.CreateResourceStream(PortableDeviceContent, "InternalStorageID", "foo.mp3", 2345))
            .Return(UnderlyingStream);

            DeviceStreamFactory.Stub(factory => factory.CreateStream(UnderlyingStream))
            .Return(DeviceStream);
        }
        protected override void GivenThat()
        {
            base.GivenThat();

            // Root parent is Device
            PortableDeviceHelper.Stub(
                helper => helper.CreateResourceStream(PortableDeviceContent, PortableDeviceConstants.WPD_DEVICE_OBJECT_ID, "new.mp3", 3456))
            .Return(UnderlyingStream);

            DeviceStreamFactory.Stub(factory => factory.CreateStream(UnderlyingStream))
            .Return(DeviceStream);
        }
        private void StubObjectFilenameAndContentType(string objectId, string fileName, Guid contentType)
        {
            PortableDeviceHelper
            .Stub(propertyHelper => propertyHelper.GetObjectFileName(
                      PortableDeviceContent,
                      objectId))
            .Return(fileName);

            PortableDeviceHelper.Stub(
                propertyHelper => propertyHelper.GetObjectContentType(PortableDeviceContent, objectId))
            .Return(contentType);
        }
Example #9
0
        protected override void GivenThat()
        {
            base.GivenThat();

            PortableDeviceHelper.Stub(
                helper => helper.CreateFolderObject(PortableDeviceContent, "xId", "y"))
            .Return("yId");

            PortableDeviceHelper.Stub(
                helper => helper.GetChildObjectIds(PortableDeviceContent, "xId"))
            .Return(new string[0]);

            PortableDeviceHelper.Stub(
                helper => helper.CreateResourceStream(PortableDeviceContent, "yId", "new.mp3", 4567))
            .Return(UnderlyingStream);

            DeviceStreamFactory.Stub(factory => factory.CreateStream(UnderlyingStream))
            .Return(DeviceStream);
        }