Ejemplo n.º 1
0
        public void When_Edit_is_called_with_an_Id_then_GetAudioAdapterSettings_on_IAudioAdapterSettingsProcess_is_called_and_the_result_is_mapped_with_AudioAdapterSettingsMapper()
        {
            var adapterSettings = AdapterSettingsCreator.CreateSingle();

            AudioProcess
            .Expect(process =>
                    process.GetAdapterSettings())
            .Return(adapterSettings)
            .Repeat.Once();
            AudioProcess.Replay();

            var updateModel = CreateUpdateAudioAdapterSettingsModel(Guid.NewGuid());

            AudioAdapterSettingsMapper
            .Expect(mapper =>
                    mapper.MapToUpdate(
                        Arg <AdapterSettings> .Matches(settings => settings.Id == adapterSettings.Id)))
            .Return(updateModel)
            .Repeat.Once();
            AudioAdapterSettingsMapper.Replay();

            var result = Controller.Edit().Result as ViewResult;

            Assert.IsNotNull(result);

            var model = result.Model as UpdateAudioAdapterSettingsModel;

            Assert.IsNotNull(model);

            AudioProcess.VerifyAllExpectations();
            AudioAdapterSettingsMapper.VerifyAllExpectations();
        }
Ejemplo n.º 2
0
        public void When_UpdateAudioAdapterSettings_is_mapped_to_a_AudioAdapterSettings_and_the_SetName_is_null_then_all_fields_are_mapped_correctly_and_SetName_in_the_result_is_null()
        {
            const string fullName = "FullName";
            const string userName = "******";
            const string userId   = "UserId";

            var entity = AdapterSettingsCreator.CreateSingle();

            AudioProcess
            .Expect(process =>
                    process.GetAdapterSettings())
            .Return(entity)
            .Repeat.Once();
            AudioProcess.Replay();

            var updateModel = new UpdateAudioAdapterSettingsModel
            {
                FullName = fullName,
                UserName = userName,
                UserId   = userId,
                SetName  = null,
            };

            var result = Mapper.Map(updateModel);

            Assert.AreEqual(null, result.SetName);
            Assert.AreNotEqual(fullName, result.OAuthAccessToken.FullName);
            Assert.AreNotEqual(userName, result.OAuthAccessToken.Username);
            Assert.AreNotEqual(userId, result.OAuthAccessToken.UserId);

            AudioProcess.VerifyAllExpectations();
        }
Ejemplo n.º 3
0
        public ProcessRow(AudioProcess audioProcess)
        {
            panel  = new System.Windows.Forms.Panel();
            muted  = new System.Windows.Forms.CheckBox();
            volume = new System.Windows.Forms.TrackBar();
            label  = new System.Windows.Forms.Label();
            icon   = new System.Windows.Forms.PictureBox();

            ID           = nextID;
            AudioProcess = audioProcess;
            Guid         = Guid.NewGuid();

            SetupChildren();
            UpdateValues();

            panel.Controls.Add(muted);
            panel.Controls.Add(volume);
            panel.Controls.Add(label);
            panel.Controls.Add(icon);

            panel.Location  = new System.Drawing.Point(0, 61 * ID);
            panel.Name      = "panel" + ID;
            panel.Size      = new System.Drawing.Size(875, 61);
            panel.TabIndex  = ID;
            panel.BackColor = System.Windows.Forms.Control.DefaultBackColor;
        }
Ejemplo n.º 4
0
        protected override void AdditionalSetup()
        {
            base.AdditionalSetup();

            AudioAdapter = MockHelper.CreateAndRegisterMock<IAudioAdapter>();
            Process = new AudioProcess(CatalogsContainer);
        }
Ejemplo n.º 5
0
        protected override void AdditionalSetup()
        {
            base.AdditionalSetup();

            AudioAdapter = MockHelper.CreateAndRegisterMock <IAudioAdapter>();
            Process      = new AudioProcess(CatalogsContainer);
        }
Ejemplo n.º 6
0
        public void When_Edit_is_called_with_a_model_then_Map_on_AudioAdapterSettingsMapper_is_called_and_the_result_is_used_to_call_UpdateAudioAdapterSettings_on_IAudioAdapterSettingsProcess_with()
        {
            var adapterSettings = AdapterSettingsCreator.CreateSingle();

            AudioProcess
            .Expect(process =>
                    process.UpdateAdapterSettings(
                        Arg <AdapterSettings> .Matches(settings =>
                                                       settings.Id == adapterSettings.Id)))
            .Return(adapterSettings)
            .Repeat.Once();
            AudioProcess.Replay();

            var updateModel = CreateUpdateAudioAdapterSettingsModel(adapterSettings.Id);

            AudioAdapterSettingsMapper
            .Expect(mapper =>
                    mapper.Map(
                        Arg <UpdateAudioAdapterSettingsModel> .Matches(m => m.SetName == adapterSettings.SetName)))
            .Return(adapterSettings)
            .Repeat.Once();
            AudioAdapterSettingsMapper.Replay();

            var result = Controller.Edit(updateModel).Result as RedirectToRouteResult;

            Assert.IsNotNull(result);

            var routeValues = result.RouteValues;

            Assert.AreEqual(1, routeValues.Count);

            foreach (var routeValue in routeValues)
            {
                Assert.AreEqual("action", routeValue.Key);
                Assert.AreEqual("Index", routeValue.Value);
            }

            AudioProcess.VerifyAllExpectations();
            AudioAdapterSettingsMapper.VerifyAllExpectations();
        }
Ejemplo n.º 7
0
 public void UpdateProcess(AudioProcess audioProcess)
 {
     audioProcess.Update();
 }