本文整理汇总了C#中Person.SetAssignedIdTo方法的典型用法代码示例。如果您正苦于以下问题:C# Person.SetAssignedIdTo方法的具体用法?C# Person.SetAssignedIdTo怎么用?C# Person.SetAssignedIdTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person
的用法示例。
在下文中一共展示了Person.SetAssignedIdTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanCreateValidAgencyFromForm
public void CanCreateValidAgencyFromForm()
{
// Establish Context
var agencyFromForm = new Agency();
var testUser = new Person();
testUser.SetAssignedIdTo(1);
_agencyManagementService.Expect(r => r.SaveOrUpdate(agencyFromForm))
.Return(ActionConfirmation.CreateSuccessConfirmation("saved"));
_authenticationProvider.Expect(r => r.GetLoggedInUser()).Return("user1");
_personManagementService.Expect(r => r.GetByUserName("user1")).Return(testUser);
// Act
RedirectToRouteResult redirectResult =
_agenciesController.Create(agencyFromForm)
.AssertActionRedirect().ToAction("Search");
// Assert
_agenciesController.TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()].ToString()
.ShouldEqual("saved");
}
示例2: CannotUpdateInvalidOrgFromForm
public void CannotUpdateInvalidOrgFromForm()
{
// Establish Context
var orgFromForm = new Org();
var viewModelToExpect = new OrgFormViewModel();
var testUser = new Person();
testUser.SetAssignedIdTo(1);
_authenticationProvider.Expect(r => r.GetLoggedInUser()).Return("user1");
_personManagementService.Expect(r => r.GetByUserName("user1")).Return(testUser);
_orgManagementService.Expect(r => r.UpdateWith(orgFromForm, 0))
.Return(ActionConfirmation.CreateFailureConfirmation("not updated"));
_orgManagementService.Expect(r => r.CreateFormViewModelFor(orgFromForm))
.Return(viewModelToExpect);
// Act
ViewResult result =
_orgsController.Edit(orgFromForm).AssertViewRendered();
// Assert
result.ViewData.Model.ShouldNotBeNull();
(result.ViewData.Model as OrgFormViewModel).ShouldNotBeNull();
}
示例3: CannotCreateInvalidAgencyFromForm
public void CannotCreateInvalidAgencyFromForm()
{
// Establish Context
var agencyFromForm = new Agency();
var viewModelToExpect = new AgencyFormViewModel();
var testUser = new Person();
testUser.SetAssignedIdTo(1);
_authenticationProvider.Expect(r => r.GetLoggedInUser()).Return("user1");
_personManagementService.Expect(r => r.GetByUserName("user1")).Return(testUser);
_agencyManagementService.Expect(r => r.SaveOrUpdate(agencyFromForm))
.Return(ActionConfirmation.CreateFailureConfirmation("not saved"));
_agencyManagementService.Expect(r => r.CreateFormViewModelFor(agencyFromForm))
.Return(viewModelToExpect);
// Act
ViewResult result =
_agenciesController.Create(agencyFromForm).AssertViewRendered();
// Assert
result.ViewData.Model.ShouldNotBeNull();
(result.ViewData.Model as AgencyFormViewModel).ShouldNotBeNull();
}
示例4: CanUpdateValidWrmsSystemFromForm
public void CanUpdateValidWrmsSystemFromForm()
{
// Establish Context
var wrmsSystemFromForm = new WrmsSystem();
var testUser = new Person();
testUser.SetAssignedIdTo(1);
_authenticationProvider.Expect(r => r.GetLoggedInUser()).Return("user1");
_personManagementService.Expect(r => r.GetByUserName("user1")).Return(testUser);
_wrmsSystemManagementService.Expect(r => r.UpdateWith(wrmsSystemFromForm, 0))
.Return(ActionConfirmation.CreateSuccessConfirmation("updated"));
// Act
RedirectToRouteResult redirectResult =
_wrmsSystemsController.Edit(wrmsSystemFromForm)
.AssertActionRedirect().ToAction("Search");
// Assert
_wrmsSystemsController.TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()].ToString()
.ShouldEqual("updated");
}