当前位置: 首页>>代码示例>>C#>>正文


C# VolunteerService.RetrieveCommitments方法代码示例

本文整理汇总了C#中VolunteerService.RetrieveCommitments方法的典型用法代码示例。如果您正苦于以下问题:C# VolunteerService.RetrieveCommitments方法的具体用法?C# VolunteerService.RetrieveCommitments怎么用?C# VolunteerService.RetrieveCommitments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VolunteerService的用法示例。


在下文中一共展示了VolunteerService.RetrieveCommitments方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WhenUserIsNullGetAllCommitmentsThrowsNullArgumentException

        public void WhenUserIsNullGetAllCommitmentsThrowsNullArgumentException()
        {
            var moqDataService = new Mock<IDataService>();
            var underTest = new VolunteerService(moqDataService.Object);

            var results = underTest.RetrieveCommitments(default(Person), false);
        }
开发者ID:jfazler,项目名称:crisischeckin,代码行数:7,代码来源:VolunteerServiceTest.cs

示例2: WhenQueryingReturnCommitmentsForThisUser

        public void WhenQueryingReturnCommitmentsForThisUser()
        {
            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),
                        Disaster=disaster
                    }
                }.AsQueryable());
            var underTest = new VolunteerService(moqDataService.Object);

            var person = new Person
            {
                Id = 1,
                FirstName = "test",
                LastName = "tester"
            };
            var results = underTest.RetrieveCommitments(person, false);
            Assert.IsTrue(results.Count() == 1);
        }
开发者ID:jfazler,项目名称:crisischeckin,代码行数:48,代码来源:VolunteerServiceTest.cs

示例3: WhenQueryingInactiveDisastersAllCommitmentsReturned

        public void WhenQueryingInactiveDisastersAllCommitmentsReturned()
        {
            var moqDataService = new Mock<IDataService>();
            var disaster = new Disaster
            {
                Id = 1,
                Name = "test",
                IsActive = false
            };
            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
                    }
                }.AsQueryable());
            var underTest = new VolunteerService(moqDataService.Object);

            const int personId = 1;
            var results = underTest.RetrieveCommitments(personId, true);
            Assert.IsTrue(results.Count() == 1);
            Assert.IsTrue(results.Single().Id == 1);
        }
开发者ID:JaimeLynSchatz,项目名称:crisischeckin,代码行数:35,代码来源:VolunteerServiceTest.cs

示例4: WhenNoCommitmentsExistAnywhereEmptyCollectionIsReturned

        public void WhenNoCommitmentsExistAnywhereEmptyCollectionIsReturned()
        {
            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.RetrieveCommitments(person, false);
            Assert.IsTrue(results.Count() == 0);
        }
开发者ID:jfazler,项目名称:crisischeckin,代码行数:28,代码来源:VolunteerServiceTest.cs

示例5: WhenPersonIdDoesNotExistReturnsEmptyList

        public void WhenPersonIdDoesNotExistReturnsEmptyList()
        {
            var moqDataService = new Mock<IDataService>();
            moqDataService.Setup(service => service.Commitments).Returns(new List<Commitment>().AsQueryable);
            var underTest = new VolunteerService(moqDataService.Object);

            var results = underTest.RetrieveCommitments(0, false);
        }
开发者ID:JaimeLynSchatz,项目名称:crisischeckin,代码行数:8,代码来源:VolunteerServiceTest.cs


注:本文中的VolunteerService.RetrieveCommitments方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。