本文整理汇总了C#中VolunteerService.RetrieveCommitmentsForDisaster方法的典型用法代码示例。如果您正苦于以下问题:C# VolunteerService.RetrieveCommitmentsForDisaster方法的具体用法?C# VolunteerService.RetrieveCommitmentsForDisaster怎么用?C# VolunteerService.RetrieveCommitmentsForDisaster使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VolunteerService
的用法示例。
在下文中一共展示了VolunteerService.RetrieveCommitmentsForDisaster方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WhenNoCommitmentsExistEmptyCollectionIsReturned
public void WhenNoCommitmentsExistEmptyCollectionIsReturned()
{
var moqDataService = new Mock<IDataService>();
moqDataService.Setup(ds => ds.Commitments)
.Returns(new List<Commitment>().AsQueryable());
var underTest = new VolunteerService(moqDataService.Object);
var person = new Person
{
Id = 1,
FirstName = "test",
LastName = "tester"
};
var disaster = new Disaster
{
Id = 1,
Name = "test",
IsActive = true
};
moqDataService.Setup(ds => ds.Disasters)
.Returns(new List<Disaster>
{
disaster
}.AsQueryable());
var results = underTest.RetrieveCommitmentsForDisaster(person, disaster);
Assert.IsTrue(results.Count() == 0);
}
示例2: WhenQueryingReturnCommitmentsOnlyForThisUser
public void WhenQueryingReturnCommitmentsOnlyForThisUser()
{
var moqDataService = new Mock<IDataService>();
var disaster = new Disaster
{
Id = 1,
Name = "test",
IsActive = true
};
moqDataService.Setup(ds => ds.Disasters)
.Returns(new List<Disaster>
{
disaster
}.AsQueryable());
moqDataService.Setup(ds => ds.Commitments)
.Returns(new List<Commitment>
{
new Commitment
{
DisasterId=1,
Id = 1,
PersonId=1,
StartDate=new DateTime(2013, 8, 1),
EndDate = new DateTime(2013, 9, 1),
Disaster=disaster
},
new Commitment
{
DisasterId=1,
Id = 2,
PersonId=2,
StartDate=new DateTime(2013, 8, 1),
EndDate = new DateTime(2013, 9, 1)
}
}.AsQueryable());
var underTest = new VolunteerService(moqDataService.Object);
var person = new Person
{
Id = 1,
FirstName = "test",
LastName = "tester"
};
var results = underTest.RetrieveCommitmentsForDisaster(person, disaster);
Assert.IsTrue(results.Count() == 1);
}
示例3: WhenDisasterIsNullGetCommitmentsThrowsNullArgumentException
public void WhenDisasterIsNullGetCommitmentsThrowsNullArgumentException()
{
var moqDataService = new Mock<IDataService>();
var underTest = new VolunteerService(moqDataService.Object);
var person = new Person
{
Id = 1,
FirstName = "test",
LastName = "tester"
};
var results = underTest.RetrieveCommitmentsForDisaster(person, default(Disaster));
}