public KeySwitchAddingResponse Execute(KeySwitchAddingRequest request) { var created = DateTimeHelper.NowUtc(); var articulation = ArticulationFactory.Create( request.ArticulationName, request.MidiNoteOns, request.MidiControlChanges, request.MidiProgramChanges, request.ExtraData ); var keySwitch = KeySwitchFactory.Create( Guid.NewGuid(), request.Author, request.Description, created, created, request.DeveloperName, request.ProductName, request.InstrumentName, new [] { articulation }, request.ExtraData ); Repository.Save(keySwitch); var response = new KeySwitchAddingResponse(true); Presenter.Complete(response); return(response); }
public void AddingTest() { var inputData = new KeySwitchAddingRequest( "Author", "Description", "Developer", "Product", "E.Guitar", "Power Chord", new List <MidiNoteOn>(), new List <MidiControlChange>(), new List <MidiProgramChange>(), new Dictionary <string, string>() ); var presenter = new IAddingPresenter.Null(); var repository = new LiteDbKeySwitchRepository(new MemoryStream()); var interactor = new AddingInteractor(repository, presenter); interactor.Execute(inputData); Assert.AreEqual(1, repository.Count()); }