public void TestUpdateExistingEducationItem() { using (RpcBroker broker = this.GetConnectedBroker()) { this.SignonToBroker(broker, 2); DsioGetEducationItemsCommand getCommand = new DsioGetEducationItemsCommand(broker); getCommand.AddCommandArguments("", "", "", 0, 0, 0); RpcResponse response = getCommand.Execute(); Assert.AreEqual(RpcResponseStatus.Success, response.Status); Assert.IsNotNull(getCommand.EducationItems); if (getCommand.EducationItems.Count > 0) { DsioEducationItem item = getCommand.EducationItems[getCommand.EducationItems.Count - 1]; string newDescription = "Edited Description " + DateTime.Now.ToString("yyMMdd"); item.Description = newDescription; item.CodeSystem = "N"; DsioSaveEducationItemCommand saveCommand = new DsioSaveEducationItemCommand(broker); saveCommand.AddCommandArguments(item); response = saveCommand.Execute(); Assert.AreEqual(RpcResponseStatus.Success, response.Status); getCommand.AddCommandArguments(item.Ien, "", "", 0, 0, 0); response = getCommand.Execute(); // NOTE: This is failing because total results are missing from command response...waiting for fix... Assert.AreEqual(RpcResponseStatus.Success, response.Status); Assert.IsNotNull(getCommand.EducationItems); DsioEducationItem editedItem = getCommand.EducationItems[0]; Assert.AreEqual(item.Description, editedItem.Description); } broker.Disconnect(); } }
public void TestSaveEducationItem() { using (RpcBroker broker = this.GetConnectedBroker()) { this.SignonToBroker(broker, 2); DsioSaveEducationItemCommand command = new DsioSaveEducationItemCommand(broker); DsioEducationItem edItem = new DsioEducationItem() { Description = "-----Purple Book", Category = "Other", ItemType = "L", Url = "http://www.medlineplus.com", CodeSystem = "L", Code = "11779-6" }; //DsioEducationItem edItem = new DsioEducationItem() //{ // Description = "Link to smoking in pregnancy video", // Category = "Smoking", // ItemType = "L", // CodeSystem = "None", // Url = "http://www.va.gov/vdl" //}; //DsioEducationItem edItem = new DsioEducationItem() //{ // Description = "D234567891123456789212345678931234567894123456789512345678961234567897123456789812345678991234567890", // Category = "C234567891123456789212345678931234567894123456789512345678961234567897123456789812345678991234567890", // ItemType = "L", // CodeSystem = "None", // Url = "U234567891123456789212345678931234567894123456789512345678961234567897123456789812345678991234567890" //}; command.AddCommandArguments(edItem); RpcResponse response = command.Execute(); Assert.AreEqual(RpcResponseStatus.Success, response.Status); Assert.IsNotNull(command.Ien); broker.Disconnect(); } }
public void TestDeleteEducationItem() { using (RpcBroker broker = this.GetConnectedBroker()) { this.SignonToBroker(broker, 2); DsioSaveEducationItemCommand command = new DsioSaveEducationItemCommand(broker); DsioEducationItem edItem = new DsioEducationItem() { Description = "This is something I want to delete on Tuesday", Category = "Smoking", ItemType = "L", CodeSystem = "None", Url = "http://www.va.gov/vdl" }; command.AddCommandArguments(edItem); RpcResponse response = command.Execute(); Assert.AreEqual(RpcResponseStatus.Success, response.Status); Assert.IsNotNull(command.Ien); DsioDeleteEducationItemCommand delCommand = new DsioDeleteEducationItemCommand(broker); delCommand.AddCommandArguments(command.Ien); response = delCommand.Execute(); Assert.AreEqual(RpcResponseStatus.Success, response.Status); DsioGetEducationItemsCommand getCommand = new DsioGetEducationItemsCommand(broker); getCommand.AddCommandArguments(command.Ien, "", "", 0, 0, 0); response = getCommand.Execute(); Assert.AreEqual(RpcResponseStatus.Success, response.Status); Assert.IsNull(getCommand.EducationItems); broker.Disconnect(); } }
public void TestSaveExistingItem() { using (RpcBroker broker = this.GetConnectedBroker()) { this.SignonToBroker(broker, 2); DsioSaveEducationItemCommand command = new DsioSaveEducationItemCommand(broker); DsioEducationItem edItem = new DsioEducationItem() { Description = "Purple Book" + DateTime.Now.ToString("yyMMdd"), Category = "Initial Materials", ItemType = "P", CodeSystem = "NONE" }; command.AddCommandArguments(edItem); RpcResponse response = command.Execute(); Assert.AreEqual(RpcResponseStatus.Success, response.Status); Assert.IsNotNull(command.Ien); edItem.Ien = command.Ien; edItem.Category = "Third Test"; command.AddCommandArguments(edItem); response = command.Execute(); Assert.AreEqual(RpcResponseStatus.Success, response.Status); Assert.IsNotNull(command.Ien); broker.Disconnect(); } }
public IenResult SaveEducationItem(EducationItem item) { IenResult result = new IenResult(); if (this.broker != null) { DsioSaveEducationItemCommand command = new DsioSaveEducationItemCommand(this.broker); DsioEducationItem dsioItem = GetDsioItem(item); command.AddCommandArguments(dsioItem); RpcResponse response = command.Execute(); result.SetResult(response.Status == RpcResponseStatus.Success, response.InformationalMessage); if (result.Success) { result.Ien = command.Ien; } } return(result); }