我正在使用Fit/Fitnesse.我有一个看起来像这样的列夹具.
!|Get Stepstools Medication Id From Vocab and String| |Concept As String|Vocabulary Name Abbr|Vocabulary Concept Id|Stepstools Med Id?| |AMOXICILLIN|RXNORM|723|1| |AMOXICILLIN| | |1| |AUGMENTIN|RXNORM|151392|8| |AUGMENTIN| | |8| |Amoxicillin 1000 MG / Clavulanate 62.5 MG Extended Release Tablet| | |8|
我试图通过使用| |测试来传递空字符串值,当我运行它时,从前一行获取值并使用它.
我的夹具代码如下所示:
public class GetStepstoolsMedicationIdFromVocabAndString: ColumnFixture
{
public string VocabularyNameAbbr;
public string VocabularyConceptId;
public string ConceptAsString;
public string StepStoolsMedId()
{
MedicationMapping mapping = MedicationMapper.GetStepMedIdFromVocabNameIdAndStringMed(
VocabularyNameAbbr,
VocabularyConceptId,
ConceptAsString
);
if (mapping.SuccessfullyMapped)
{
return mapping.StepstoolsMedicationId.ToString();
}
else
{
return mapping.ErrorMessage;
} …Run Code Online (Sandbox Code Playgroud) 请有人帮助我.我已经研究了几个小时,已经尝试了很多不同的建议修复,我完全失去了为什么我仍然得到这个错误.
我有一个ASP.NET 4.0网页,其中包含以下代码:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(targetHref);
// request.KeepAlive = false;
// request.ProtocolVersion = System.Net.HttpVersion.Version10;
// request.ServicePoint.Expect100Continue = false;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Run Code Online (Sandbox Code Playgroud)
我已经尝试了我可以想象的所有组合,不评论上述3条注释行.
我在web.config中有这个:
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing ="true"/>
</settings>
</system.net>
Run Code Online (Sandbox Code Playgroud)
当我在我的开发机器上运行Fiddler时,页面运行无例外,fiddler在返回的顶部显示此消息:
HTTP/1.0 200这个错误的服务器没有返回标头
如果没有Fiddler运行,我每次都会收到错误request.GetResponse().
我有一个这样的课:
public class RxNormFolderMgr
{
// properties
public string RxNormFolder { get { return ConfigurationSettings.AppSettings["rootFolder"].ToString(); } }
}
Run Code Online (Sandbox Code Playgroud)
当我尝试使用它时:
public class TestRxNormFolderManager : ColumnFixture
{
public string RxNormFolder()
{
RxNormFolderMgr folderMgr = new RxNormFolderMgr();
return folderMgr.RxNormFolder;
}
}
Run Code Online (Sandbox Code Playgroud)
我收到一个错误:"System.Reflection.TargetInvocationException:调用目标抛出异常.---> System.NullReferenceException:对象引用未设置为对象的实例." AppSettings的AllKeys属性是一个零长度的数组,我希望长度为1.
我在项目中的app.config文件如下所示:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="rootFolder" value ="C:\RxNorm" />
<!-- Root folder must not end with slash. -->
</appSettings>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我知道ConfigurationSettings.AppSettings应该是过时的,我应该使用ConfigurationManager.AppSettings,但我甚至无法编译.我在项目中有一个参考System.configuration(在我的机器上的c:\ WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.configuration.dll)并在我的代码顶部使用语句.
我正在使用Fitnesse来测试代码,那是我收到错误的时候.我的理解是,我还应该将app.config文件的副本放在我已经完成的测试夹具项目的Bin> Debug文件夹中.所以,我不知道为什么我仍然会收到这个错误.
请帮忙.
我有这个方法......
public static IList<IOutgoingMessage> CompressMessages(IList<IOutgoingMessageWithUserAndPtMedInfo> msgs)
{
StoreOriginalMessages(msgs);
...
}
Run Code Online (Sandbox Code Playgroud)
调用这种方法......
private static void StoreOriginalMessages(IList<IOutgoingMessage> msgs) {...}
Run Code Online (Sandbox Code Playgroud)
并且IOutgoingMessageWithUserAndPtMedInfo被定义为这样......
public interface IOutgoingMessageWithUserAndPtMedInfo: IOutgoingMessage
{
IPatientMedication PatientMedication { get; set; }
IUserContainer User{ get; set; }
}
Run Code Online (Sandbox Code Playgroud)
当我尝试StoreOriginalMessages从我的CompressMessages方法调用时出现此错误:
无法从'System.Collections.Generic.IList <MyMediHealth.DataAccess.Containers.IOutgoingMessageWithUserAndPtMedInfo>' 转换为'System.Collections.Generic.IList <MyMediHealth.DataAccess.Containers.IOutgoingMessage>'
不明白为什么.我希望它会接受它,因为IOutgoingMessageWithUserAndPtMedInfo继承自IOutgoingMessage.
我究竟做错了什么?