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


C# VolunteerService.UpdateDetails方法代码示例

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


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

示例1: UpdateDetails_Valid

        public void UpdateDetails_Valid()
        {
            Person moqPerson = new Person()
            {
                Id = 1,
                UserId = null,
                FirstName = "Cathy",
                LastName = "Jones",
                Email = "[email protected]",
                PhoneNumber = "555-222-9139",
                ClusterId = 1
            };

            List<Person> people = new List<Person>();
            people.Add(moqPerson);

            var moqDataService = new Mock<IDataService>();
            moqDataService.Setup(s => s.Persons).Returns(people.AsQueryable());
            moqDataService.Setup(s => s.UpdatePerson(It.IsAny<Person>())).Returns(new Person() {
                Id = 1,
                Email = "[email protected]",
                FirstName = "Cathy",
                LastName = "CHANGED",
                PhoneNumber = "555-222-9139",
                ClusterId = 1
            });

            VolunteerService service = new VolunteerService(moqDataService.Object);
            var actual = service.UpdateDetails(new Person()
            {
                Id = 1, Email = "[email protected]", FirstName = "Cathy", LastName = "CHANGED", PhoneNumber = "555-222-9139", ClusterId = 1
            });

            // Only Last Name has been updated
            Assert.AreEqual("CHANGED", actual.LastName);

            Assert.AreEqual("Cathy", actual.FirstName);
        }
开发者ID:jfazler,项目名称:crisischeckin,代码行数:38,代码来源:VolunteerServiceTest.cs

示例2: UpdateDetails_PersonNotFound

        public void UpdateDetails_PersonNotFound()
        {
            Person moqPerson = new Person()
            {
                Id = 1,
                UserId = null,
                FirstName = "Cathy",
                LastName = "Jones",
                Email = "[email protected]",
                PhoneNumber = "555-222-9139"
            };

            List<Person> people = new List<Person>();
            people.Add(moqPerson);

            var moqDataService = new Mock<IDataService>();
            moqDataService.Setup(s => s.Persons).Returns(people.AsQueryable());
            VolunteerService service = new VolunteerService(moqDataService.Object);

            service.UpdateDetails(new Person()
            {
                Id = 25,
                Email = "[email protected]"
            });
        }
开发者ID:jfazler,项目名称:crisischeckin,代码行数:25,代码来源:VolunteerServiceTest.cs

示例3: UpdateDetails_PersonEmailAlreadyInUse

        public void UpdateDetails_PersonEmailAlreadyInUse()
        {
            Person moqPersonOne = new Person()
            {
                Id = 1,
                UserId = null,
                FirstName = "Cathy",
                LastName = "Jones",
                Email = "[email protected]",
                PhoneNumber = "555-222-9139"
            };

            Person moqPersonTwo = new Person()
            {
                Id = 2,
                UserId = null,
                FirstName = "Stan",
                LastName = "Smith",
                Email = "[email protected]",
                PhoneNumber = "111-333-2222"
            };

            List<Person> people = new List<Person>();
            people.Add(moqPersonOne);
            people.Add(moqPersonTwo);

            var moqDataService = new Mock<IDataService>();
            moqDataService.Setup(s => s.Persons).Returns(people.AsQueryable());

            VolunteerService service = new VolunteerService(moqDataService.Object);
            // Try to change Cathy Jones' email to Stan Smith's email...
            service.UpdateDetails(new Person()
            {
                Id = 1,
                Email = "[email protected]",
                FirstName = "Cathy",
                LastName = "Jones"
            });
        }
开发者ID:jfazler,项目名称:crisischeckin,代码行数:39,代码来源:VolunteerServiceTest.cs

示例4: UpdateDetails_NullPerson

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

            service.UpdateDetails(null);
        }
开发者ID:jfazler,项目名称:crisischeckin,代码行数:7,代码来源:VolunteerServiceTest.cs

示例5: UpdateDetails_ChangeEmailToUnusuedEmail_DoesNotThrowPersonEmailAlreadyInUseException

        public void UpdateDetails_ChangeEmailToUnusuedEmail_DoesNotThrowPersonEmailAlreadyInUseException()
        {
            Person moqPersonOne = new Person()
            {
                Id = 1,
                UserId = null,
                FirstName = "Cathy",
                LastName = "Jones",
                Email = "[email protected]",
                PhoneNumber = "555-222-9139"
            };

            List<Person> people = new List<Person>();
            people.Add(moqPersonOne);

            var moqDataService = new Mock<IDataService>();
            moqDataService.Setup(s => s.Persons).Returns(people.AsQueryable());

            VolunteerService service = new VolunteerService(moqDataService.Object);
            // Try to change Cathy Jones' email to something not in use...
            service.UpdateDetails(new Person()
            {
                Id = 1,
                Email = "[email protected]",
                FirstName = "Cathy",
                LastName = "Jones"
            });
        }
开发者ID:JaimeLynSchatz,项目名称:crisischeckin,代码行数:28,代码来源:VolunteerServiceTest.cs

示例6: UpdateDetails_DoesNotClearFirstOrLastNameIfBlank

        public void UpdateDetails_DoesNotClearFirstOrLastNameIfBlank()
        {
            var moqPersonOne = new Person
            {
                Id = 1,
                UserId = 6,
                FirstName = "Cathy",
                LastName = "Jones",
                Email = "[email protected]",
                PhoneNumber = "555-222-9139"
            };

            var people = new List<Person> {moqPersonOne};

            var moqDataService = new Mock<IDataService>();
            moqDataService.Setup(s => s.Persons).Returns(people.AsQueryable());
            moqDataService.Setup(s => s.UpdatePerson(It.IsAny<Person>())).Returns((Person p) => p);

            var service = new VolunteerService(moqDataService.Object);

            Person actual = service.UpdateDetails(new Person
            {
                Id = 1,
                UserId = 6,
                FirstName = null,
                LastName = null,
                Email = "[email protected]",
                PhoneNumber = "555-222-9139"
            });

            Assert.IsNotNull(actual);
            Assert.IsFalse(string.IsNullOrEmpty(actual.FirstName), "Expected First Name not to be null or empty.");
            Assert.IsFalse(string.IsNullOrEmpty(actual.LastName), "Expected Last Name not to be null or empty.");
        }
开发者ID:dayewah,项目名称:crisischeckin,代码行数:34,代码来源:VolunteerServiceTest.cs


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