CallResultData
Namespace:
AutoFixture.AutoNSubstitute
We found 10 examples in language CSharp for this search.
You will see 19 fragments of code.
Other methods
Other methods
Project:AutoFixture
File:CallResultCacheTest.cs
Examples:2
[Fact]
public void AddRowShouldFailForNullCallSpecification()
{
// Arrange
var sut = new CallResultCache();
var callResult = new CallResultData(Maybe.Nothing<object>(),
Enumerable.Empty<CallResultData.ArgumentValue>());
// Act & Assert
Assert.Throws<ArgumentNullException>(() => sut.AddResult(null, callResult));
}
[Fact]
public void TryGetValueShouldFailForNullCall()
{
// Arrange
var sut = new CallResultCache();
// Act & Assert
Assert.Throws<ArgumentNullException>(() => sut.TryGetResult(null, out CallResultData _));
}
Project:AutoFixture
File:CallResultCache.cs
Examples:2
/// <inheritdoc />
public void AddResult(ICallSpecification callSpecification, CallResultData result)
{
if (callSpecification == null) throw new ArgumentNullException(nameof(callSpecification));
if (result == null) throw new ArgumentNullException(nameof(result));
this.CallResults.Push(new ResultForCallSpec(callSpecification, result));
}
/// <inheritdoc />
public bool TryGetResult(ICall callInfo, out CallResultData callResult)
{
if (callInfo == null) throw new ArgumentNullException(nameof(callInfo));
var result = this.CallResults.FirstOrDefault(c => c.IsResultFor(callInfo));
callResult = result?.Result;
return result != null;
}
Project:AutoFixture
File:CallResultData.cs
Examples:1
using System.Collections.Generic;
using NSubstitute.Core;
namespace AutoFixture.AutoNSubstitute.CustomCallHandler
{
/// <summary>
/// Storage for a single resolved call result.
/// </summary>
public class CallResultData
{
/// <summary>
/// Value that should be returned.
/// </summary>
public Maybe<object> ReturnValue { get; }
/// <summary>
/// Ref/Out argument values.
/// </summary>
public IEnumerable<ArgumentValue> ArgumentValues { get; }
/// <summary>
/// Initializes instance of the <see cref="CallResultData"/>.
/// </summary>
public CallResultData(Maybe<object> returnValue, IEnumerable<ArgumentValue> argumentValues)
{
this.ReturnValue = returnValue;
this.ArgumentValues = argumentValues;
}
/// <summary>
/// Intance represents resolved argument value by index.
/// </summary>
public class ArgumentValue
{
/// <summary>
/// Argument index starting from zero.
/// </summary>
public int Index { get; }
/// <summary>
/// Argument value.
/// </summary>
public object Value { get; }
/// <summary>
/// Creates an instance of <see cref="ArgumentValue"/>.
/// </summary>
public ArgumentValue(int index, object value)
{
this.Index = index;
this.Value = value;
}
}
}
}
Project:AutoFixture
File:ICallResultCache.cs
Examples:2
/// <summary>
/// Adds result for the passed <paramref name="callSpecification"/>.
/// </summary>
void AddResult(ICallSpecification callSpecification, CallResultData result);
/// <summary>
/// Returns the latest registered result that matches the passed call.
/// </summary>
bool TryGetResult(ICall callInfo, out CallResultData callResult);
Project:AutoFixture
File:CallResultDataTest.cs
Examples:1
[Fact]
public void ConstructorShouldSetCorrectProperties()
{
// Arrange
var retValue = Maybe.Just(new object());
var argumentValues = new CallResultData.ArgumentValue[1];
// Act
var sut = new CallResultData(retValue, argumentValues);
// Assert
Assert.Equal(retValue, sut.ReturnValue);
Assert.Same(argumentValues, sut.ArgumentValues);
}
Project:AutoFixture
File:ICallResultResolver.cs
Examples:1
/// <summary>
/// Resolve result for the call.
/// </summary>
CallResultData ResolveResult(ICall callInfo);
Project:sedasTest
File:ViewResultPopup.cs
Examples:6
/// <summary>
/// name : ViewResultPopup_Load
/// desc : 화면로드시
/// author : 심우종
/// create date : 2020-04-23 13:58
/// update date : 최종 수정일자 , 수정자, 수정개요
/// </summary>
private void ViewResultPopup_Load(object sender, EventArgs e)
{
if (g_DBconnectData.strIsDev == "Y")
{
this.callService = new CallService("10.10.221.71", "8180");
this.Text = this.Text + " (개발)";
}
else
{
this.callService = new CallService(g_DBconnectData.strCallService);
}
}
/// <summary>
/// name : InitControl
/// desc : 컨트롤을 초기화한다.
/// author : 심우종
/// create date : 2020-04-23 13:58
/// update date : 최종 수정일자 , 수정자, 수정개요
/// </summary>
private void InitControl()
{
//전송상태 콤보박스 데이터
DataTable dt = new DataTable();
dt.Columns.Add("cdVal");
dt.Columns.Add("cdValNm");
String[] statMaster = { "0", "8", "9", "1" };
for (int i = 0; i < statMaster.Count(); i++)
{
if (g_ComboData.strarrayChar.Count > i)
{
DataRow row = dt.NewRow();
row["cdVal"] = statMaster.ElementAt(i).ToString();
row["cdValNm"] = statMaster.ElementAt(i).ToString();
dt.Rows.Add(row);
}
}
this.cmbSendState.DataBindingFromDataTable(dt, "cdVal", "cdValNm");
}
/// <summary>
/// name : InitData
/// desc : 데이터 초기화
/// author : 심우종
/// create date : 2020-04-23 09:22
/// update date : 최종 수정일자 , 수정자, 수정개요
/// </summary>
public void InitData(DataRow row)
{
this.workData = row;
this.studyId = row["studyId"].ToString();
DataTable resultDt = this.GetInfo(row["studyId"].ToString());
if (resultDt != null && resultDt.Rows.Count > 0)
{
this.txtPtNo.Text = this.m_SourcePtNo = resultDt.Rows[0]["ptNo"].ToString();
this.txtPtNm.Text = resultDt.Rows[0]["ptNm"].ToString();
this.txtEngNm.Text = resultDt.Rows[0]["engNm"].ToString();
this.txtBirth.Text = resultDt.Rows[0]["birth"].ToString();
this.txtAge.Text = resultDt.Rows[0]["age"].ToString();
this.txtSex.Text = resultDt.Rows[0]["sex"].ToString();
this.txtGi.Text = resultDt.Rows[0]["gi"].ToString();
this.txtMi.Text = resultDt.Rows[0]["mi"].ToString();
this.txtOi.Text = resultDt.Rows[0]["oi"].ToString();
this.cmbSendState.SedasSelectedValue = resultDt.Rows[0]["sendStat"].ToString();
this.lblPtoNo.Text = resultDt.Rows[0]["ptoNo"].ToString();
this.txtStudyRslt.Text = resultDt.Rows[0]["studyRslt"].ToString();
this.dbDataRow = resultDt.Rows[0];
//this.ptoNo = resultDt.Rows[0]["ptoNo"].ToString();
//this.studyDt = resultDt.Rows[0]["studyDt"].ToString();
}
}
/// <summary>
/// name : GetInfo
/// desc : 정보를 조회한다.
/// author : 심우종
/// create date : 2020-04-23 13:47
/// update date : 최종 수정일자 , 수정자, 수정개요
/// </summary>
private DataTable GetInfo(string studyId)
{
KeyValueData param = new KeyValueData();
param.Add("Data1", studyId);
CallResultData result = this.callService.SelectSql("reqGetViewerViewResult", param);
if (result.resultState == ResultState.OK && result.resultData != null && result.resultData.Rows.Count > 0)
{
//데이터 조회 성공
DataTable dt = result.resultData;
//string patNo = dt.Rows[0]["ptoNo"].ToString();
return dt;
}
else
{
//실패에 대한 처리
DevExpress.XtraEditors.XtraMessageBox.Show("UpdateDlg : Select StudyTlb fail");
}
return null;
}
/// <summary>
/// name : btnClose_Click
/// desc : 닫기버튼 클릭시
/// author : 심우종
/// create date : 2020-04-23 14:35
/// update date : 최종 수정일자 , 수정자, 수정개요
/// </summary>
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
/// <summary>
/// name : btnSave_Click
/// desc : 저장버튼 클릭시
/// author : 심우종
/// create date : 2020-04-23 14:36
/// update date : 최종 수정일자 , 수정자, 수정개요
/// </summary>
private void btnSave_Click(object sender, EventArgs e)
{
if (this.dbDataRow == null)
{
DevExpress.XtraEditors.XtraMessageBox.Show("데이터를 저장할수 없습니다.");
return;
}
if (this.m_SourcePtNo != this.txtPtNo.Text)
{
bool isNeedToNewPtNo = false; //신규 환자번호 생성 필요여부
//변경된 환자 번호가 있는지 확인하고.
KeyValueData param = new KeyValueData();
param.Add("Data1", this.txtPtNo.Text);
CallResultData result = this.callService.SelectSql("reqGetViewerPtNoExist", param);
if (result.resultState == ResultState.OK)
{
//데이터 조회 성공
DataTable dt = result.resultData;
if (dt != null && dt.Rows.Count > 0)
{
//기존에 환자가 존재함. PASS
}
else
{
if (DevExpress.XtraEditors.XtraMessageBox.Show("환자번호가 변경 되었습니다.\n\r\n\r변경된 환자정보를 추가 하시겠습니까?", "데이터 수정", buttons: MessageBoxButtons.YesNo) == DialogResult.Yes)
{
isNeedToNewPtNo = true;
}
}
}
else
{
//실패에 대한 처리
DevExpress.XtraEditors.XtraMessageBox.Show("DataUpdateDlg : Search Patient fail.");
return;
}
if (isNeedToNewPtNo == true)
{
if (this.InsertPatInfo() == false)
{
DevExpress.XtraEditors.XtraMessageBox.Show("DataUpdateDlg : Insert Patient fail.");
return;
}
}
}
this.UpdateStudyInfo();
}
Project:sedasTest
File:CallResultData.cs
Examples:1
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sedas.DB
{
public enum ResultState
{
NONE, //미확인
OK, //성공
FAIL //실패
}
public class CallResultData
{
public ResultState resultState = ResultState.NONE; //DB연결 결과코드
public DataTable resultData; //결과값 리턴용
public List<DataTable> resultDataList; //결과값이 여러개의 테이블로 리턴되는 경우에 대한 처리
public string errorMessage = "";
}
}
Project:AutoFixture
File:GlobalSuppressions.cs
Examples:1
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
//
// To add a suppression to this file, right-click the message in the
// Code Analysis results, point to "Suppress Message", and click
// "In Suppression File".
// You do not need to add suppressions to this file manually.
using System.Diagnostics.CodeAnalysis;
[assembly:
SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes",
Scope = "namespace", Target = "AutoFixture.AutoNSubstitute",
Justification = "This is the root namespace of the project. There is no other namespace those types could be merged with.")]
[assembly:
SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames",
Justification = "AutoFixture itself currently doesn't have a strong name.")]
[assembly:
SuppressMessage("Microsoft.Design", "CA1014:MarkAssembliesWithClsCompliant",
Justification = "NSubstitute contains non-CLS compliant types and they are used, so lib is not CLS compliant.")]
[assembly:
SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible",
Scope = "type", Target = "AutoFixture.AutoNSubstitute.CustomCallHandler.CallResultData+ArgumentValue",
Justification =
"It's defined as a sub-class because it's very tiny and it's just a way to group data together." +
"It's never used without its parent and doesn't bring any value without parent.")]
Project:AutoFixture
File:AutoFixtureValuesHandler.cs
Examples:2
/// <summary>
/// Try to handle the call - set ref/out params and return value.
/// </summary>
public RouteAction Handle(ICall call)
{
if (call == null) throw new ArgumentNullException(nameof(call));
// Don't care about concurrency. If race condition happens - simply use the latest result.
CallResultData result;
if (!this.ResultCache.TryGetResult(call, out result))
{
result = this.ResultResolver.ResolveResult(call);
var callSpec = this.CallSpecificationFactory.CreateFrom(call, MatchArgs.AsSpecifiedInCall);
this.ResultCache.AddResult(callSpec, result);
}
var callArguments = call.GetArguments();
var originalArguments = call.GetOriginalArguments();
foreach (var argumentValue in result.ArgumentValues)
{
var argIndex = argumentValue.Index;
// If ref/out value has been already modified (e.g. by When..Do), don't override that value.
if (!ArgValueWasModified(callArguments[argIndex], originalArguments[argIndex]))
{
callArguments[argIndex] = argumentValue.Value;
}
}
return result.ReturnValue.Fold(RouteAction.Continue, RouteAction.Return);
}
private static bool ArgValueWasModified(object current, object original)
{
return !ReferenceEquals(current, original);
}
AutoFixture.AutoNSubstitute.CustomCallHandler.CallResultData : Object
Constructors :
public CallResultData(Maybe<Object> returnValue = , IEnumerable<ArgumentValue> argumentValues = )Methods :
public Maybe<Object> get_ReturnValue()public IEnumerable<ArgumentValue> get_ArgumentValues()
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()