本文整理汇总了C#中IUDICO.Common.Models.Shared.User类的典型用法代码示例。如果您正苦于以下问题:C# User类的具体用法?C# User怎么用?C# User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
User类属于IUDICO.Common.Models.Shared命名空间,在下文中一共展示了User类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: InvalidateUser
public void InvalidateUser()
{
// original caching
//this.tests.Storage.GetUsers();
tests = UserManagementTests.Update();
var temp = new User { Username = "name", Email = "[email protected]", Password = "pass123" };
this.tests.Storage.CreateUser(temp);
var user = this.tests.Storage.GetUsers().SingleOrDefault(u => u.Username == temp.Username);
Assert.IsNotNull(user);
temp = this.tests.Storage.GetUser("name");
var expected = new User
{
Username = "name",
Email = "[email protected]",
Password = "pass123",
Id = temp.Id,
OpenId = "openid"
};
this.tests.Storage.EditUser(temp.Id, new EditUserModel(expected));
user = this.tests.Storage.GetUsers().SingleOrDefault(u => u.Username == temp.Username);
Assert.IsTrue(this.tests.TestUsers(this.tests.Storage.GetUser("name"), expected));
Assert.IsTrue(this.tests.TestUsers(user, expected));
this.tests.Storage.DeleteUser(u => u.Id == temp.Id);
Assert.IsNull(this.tests.Storage.GetUser("name"));
}
开发者ID:supermuk,项目名称:iudico,代码行数:33,代码来源:Cache.cs
示例2: CreateUserInvalid
public void CreateUserInvalid()
{
User temp = new User {Username = "name", Email = "[email protected]"};
_Tests.MockStorage.Setup(s => s.GetCurrentUser()).Returns(_Tests.Storage.GetUser(u => u.Username == "panza"));
_Tests.Storage.CreateUser(temp);
}
开发者ID:supermuk,项目名称:iudico,代码行数:7,代码来源:CreateNewUser.cs
示例3: CalculateSpecializedResultTest
public void CalculateSpecializedResultTest()
{
User usr = new User() { Username = "Bob" };
Topic thm = new Topic() { Name = "Topic One" };
AttemptResult AR = new AttemptResult(1, usr, thm, CompletionStatus.Completed, AttemptStatus.Completed, SuccessStatus.Passed, DateTime.Now, 0.5f);
TopicResult topicRes = new TopicResult(usr, thm);
List<AttemptResult> ARL = new List<AttemptResult>();
ARL.Add(AR);
topicRes.AttemptResults = ARL;
topicRes.GetTopicResultScore();
DisciplineResult currRes = new DisciplineResult();
currRes.TopicResult.Add(topicRes);
Discipline curr = null;
currRes.CalculateSumAndMax(usr, curr);
SpecializedResult target = new SpecializedResult();
target.DisciplineResult.Add(currRes);
target.CalculateSpecializedResult(usr);
double? ExpectedSum = 50.0;
double? ExpectedMax = 100.0;
double? ExpectedPercent = 50.0;
char ExpextedECTS = 'F';
Assert.AreEqual(ExpectedSum, target.Sum);
Assert.AreEqual(ExpectedMax, target.Max);
Assert.AreEqual(ExpectedPercent, target.Percent);
Assert.AreEqual(ExpextedECTS, target.ECTS);
}
开发者ID:supermuk,项目名称:iudico,代码行数:31,代码来源:SpecializedResultTest.cs
示例4: ChangePasswordWithBlankDataTest
public void ChangePasswordWithBlankDataTest()
{
this.tests = UserManagementTests.Update();
var model = new ChangePasswordModel { OldPassword = string.Empty, ConfirmPassword = "321", NewPassword = "321" };
var temp = new User { Username = "name", Email = "[email protected]", Password = "123" };
this.tests.ChangeCurrentUser("panza");
this.tests.Storage.CreateUser(temp);
this.tests.ChangeCurrentUser("name");
try
{
this.tests.Storage.ChangePassword(model);
}
catch (Exception e)
{
this.tests.Storage.DeleteUser(u => u.Username == "name");
if (e.Message == "Old password can't be empty.")
{
Assert.Pass();
}
Assert.Fail();
}
this.tests.Storage.DeleteUser(u => u.Username == "name");
Assert.Fail();
}
开发者ID:supermuk,项目名称:iudico,代码行数:29,代码来源:ChangePassword.cs
示例5: EditUserValid
public void EditUserValid()
{
tests = new UserManagementTests();
var temp = new User { Username = "name", Email = "[email protected]", Password = "pass123" };
this.tests.Storage.CreateUser(temp);
temp = this.tests.Storage.GetUser("name");
var expected = new User
{
Username = "name",
Email = "[email protected]",
Password = "pass123",
Id = temp.Id,
OpenId = "openid"
};
var model = new EditUserModel(expected);
this.tests.Storage.EditUser(temp.Id, model);
var compare = this.tests.Storage.GetUser("name");
Assert.IsTrue(this.tests.TestUsers(compare, expected) && compare.OpenId == expected.OpenId);
this.tests.Storage.DeleteUser(u => u.Username == "name");
}
开发者ID:supermuk,项目名称:iudico,代码行数:29,代码来源:EditUsersAccount.cs
示例6: UpdateUserAverage
public void UpdateUserAverage()
{
tests = UserManagementTests.Update();
var user = new User { Username = "name1", Email = "[email protected]", Password = "123" };
this.tests.Storage.CreateUser(user);
var attemptResult = new AttemptResult
{
AttemptId = 1,
AttemptStatus = AttemptStatus.Completed,
CompletionStatus = CompletionStatus.Completed,
FinishTime = DateTime.Now,
StartTime = DateTime.Now,
Score = new Score(0, 50, 45, 0.9F),
SuccessStatus = SuccessStatus.Passed,
TopicType = TopicTypeEnum.Test,
User = this.tests.Storage.GetUser(user.Username)
};
this.tests.Storage.UpdateUserAverage(attemptResult);
var testUser = this.tests.Storage.GetUser(user.Username);
Assert.IsTrue(testUser.TestsTotal == 1);
Assert.IsTrue(testUser.TestsSum == 90);
this.tests.Storage.DeleteUser(u => u.Username == "name1");
}
开发者ID:supermuk,项目名称:iudico,代码行数:28,代码来源:Analytics.cs
示例7: CreateUserInvalid
public void CreateUserInvalid()
{
tests = new UserManagementTests();
var temp = new User { Username = "name", Email = "[email protected]" };
this.tests.Storage.CreateUser(temp);
}
开发者ID:supermuk,项目名称:iudico,代码行数:7,代码来源:CreateNewUser.cs
示例8: EditUserValid
public void EditUserValid()
{
User temp = new User {Username = "name", Email = "[email protected]", Password = "pass123"};
_Tests.MockStorage.Setup(s => s.GetCurrentUser()).Returns(_Tests.Storage.GetUser(u => u.Username == "panza"));
_Tests.Storage.CreateUser(temp);
temp = _Tests.Storage.GetUser(u => u.Username == "name");
User expected = new User
{
Username = "name",
Email = "[email protected]",
Password = "pass123",
Id = temp.Id,
OpenId = "openid"
};
var model = new EditUserModel(expected);
_Tests.Storage.EditUser(temp.Id, model);
var compare = _Tests.Storage.GetUser(u => u.Username == "name");
Assert.IsTrue(_Tests.TestUsers(compare, expected) && compare.OpenId == expected.OpenId);
_Tests.Storage.DeleteUser(u => u.Username == "name");
}
开发者ID:supermuk,项目名称:iudico,代码行数:26,代码来源:EditUsersAccount.cs
示例9: AddUserStats
public void AddUserStats(User user,
int totalNumberOfRequests,
int todayNumberOfRequests,
DateTime lastActivityTime)
{
_stats.Add(new UserActivityStats(
user, totalNumberOfRequests, todayNumberOfRequests, lastActivityTime));
}
开发者ID:supermuk,项目名称:iudico,代码行数:8,代码来源:OverallViewModel.cs
示例10: GetUser
public void GetUser()
{
User temp = new User { Username = "iper", Email = "[email protected]", Password = "pass123" };
_Tests.MockStorage.Setup(s => s.GetCurrentUser()).Returns(_Tests.Storage.GetUser(u => u.Username == "panza"));
_Tests.Storage.CreateUser(temp);
Assert.IsTrue(_Tests.TestUsers(temp, _Tests.Storage.GetUser(u => u.Username == "iper")));
}
开发者ID:supermuk,项目名称:iudico,代码行数:9,代码来源:SeeUsersDetails.cs
示例11: ChangePasswordSuccess
public void ChangePasswordSuccess()
{
var model = new ChangePasswordModel {OldPassword = "123", ConfirmPassword = "123", NewPassword = "321"};
User temp = new User { Username = "ipepp", Email = "[email protected]", Password = "123" };
_Tests.MockStorage.Setup(s => s.GetCurrentUser()).Returns(_Tests.Storage.GetUser(u => u.Username == "panza"));
_Tests.Storage.CreateUser(temp);
_Tests.MockStorage.Setup(s => s.GetCurrentUser()).Returns(_Tests.Storage.GetUser(u => u.Username == "ipepp"));
_Tests.Storage.ChangePassword(model);
Assert.AreEqual(_Tests.Storage.GetUser(u => u.Username == "ipepp").Password, _Tests.Storage.EncryptPassword("321"));
}
开发者ID:supermuk,项目名称:iudico,代码行数:10,代码来源:ChangePassword.cs
示例12: DeleteUserExisting
public void DeleteUserExisting()
{
tests = new UserManagementTests();
var temp = new User { Username = "Username", Email = "[email protected]", Password = "123" };
this.tests.Storage.CreateUser(temp);
this.tests.Storage.DeleteUser(u => u.Username == "Username");
Assert.IsTrue(this.tests.Storage.GetUser(u => u.Username == "Username") == null);
}
开发者ID:supermuk,项目名称:iudico,代码行数:11,代码来源:DeleteUser.cs
示例13: UserActivityStats
public UserActivityStats(
User user,
int totalNumberOfRequests,
int todayNumberOfRequests,
DateTime lastActivityTime)
{
this.User = user;
this.TotalNumberOfRequests = totalNumberOfRequests;
this.TodayNumberOfRequests = todayNumberOfRequests;
this.LastActivityTime = lastActivityTime;
}
开发者ID:supermuk,项目名称:iudico,代码行数:11,代码来源:OverallViewModel.cs
示例14: EditUserNonExisting
public void EditUserNonExisting()
{
User temp = new User { Username = "name", Email = "[email protected]", Password = "pass123" };
_Tests.MockStorage.Setup(s => s.GetCurrentUser()).Returns(_Tests.Storage.GetUser(u => u.Username == "panza"));
User expected = new User { Username = "name", Email = "[email protected]", Password = "pass123", Id = temp.Id, OpenId = "openid" };
var model = new EditUserModel(expected);
_Tests.Storage.EditUser(temp.Id, model);
}
开发者ID:supermuk,项目名称:iudico,代码行数:11,代码来源:EditUsersAccount.cs
示例15: AddNonExistingUserToNonExistingGroup
public void AddNonExistingUserToNonExistingGroup()
{
tests = UserManagementTests.Update();
var group = new Group { Id = 12366, Name = "pmp51" };
var temp = new User { Username = "name", Email = "[email protected]", Password = "123" };
this.tests.Storage.AddUserToGroup(group, temp);
Assert.IsFalse(this.tests.Storage.GetUsersInGroup(group).Contains(temp));
Assert.AreEqual(0, this.tests.Storage.GetGroupsByUser(temp).Count());
}
开发者ID:supermuk,项目名称:iudico,代码行数:11,代码来源:AddUserToGroup.cs
示例16: CreateUserValid
public void CreateUserValid()
{
tests = new UserManagementTests();
var temp = new User { Username = "name", Email = "[email protected]", Password = "123" };
this.tests.Storage.CreateUser(temp);
var expected = this.tests.Storage.GetUser(u => u.Username == "name");
Assert.IsTrue(temp.Username == expected.Username && temp.Email == expected.Email);
}
开发者ID:supermuk,项目名称:iudico,代码行数:11,代码来源:CreateNewUser.cs
示例17: ChangePasswordIncorrect
public void ChangePasswordIncorrect()
{
var model = new ChangePasswordModel { OldPassword = "123", ConfirmPassword = "323", NewPassword = "321" };
User temp = new User { Username = "name", Email = "[email protected]", Password = "123" };
_Tests.MockStorage.Setup(s => s.GetCurrentUser()).Returns(_Tests.Storage.GetUser(u => u.Username == "panza"));
_Tests.Storage.CreateUser(temp);
_Tests.MockStorage.Setup(s => s.GetCurrentUser()).Returns(_Tests.Storage.GetUser(u => u.Username == "name"));
_Tests.Storage.ChangePassword(model);
Assert.AreEqual(_Tests.Storage.GetUser(u => u.Username == "name").Password, _Tests.Storage.EncryptPassword("321"));
_Tests.Storage.DeleteUser(u => u.Username == "name");
}
开发者ID:supermuk,项目名称:iudico,代码行数:11,代码来源:ChangePassword.cs
示例18: RemoveNonExistingUserFromNonExistingGroup
public void RemoveNonExistingUserFromNonExistingGroup()
{
var group = new Group { Id = 345678, Name = "pmi31" };
var temp = new User { Username = "name", Email = "[email protected]", Password = "123" };
this.tests.Storage.AddUserToGroup(group, temp);
this.tests.Storage.RemoveUserFromGroup(group, temp);
Assert.AreEqual(null, this.tests.Storage.GetUser(u => u.Username == temp.Username));
Assert.AreEqual(0, this.tests.Storage.GetGroupsByUser(temp).Count());
}
开发者ID:supermuk,项目名称:iudico,代码行数:11,代码来源:RemoveUserFromGroup.cs
示例19: DeleteUserExisting
public void DeleteUserExisting()
{
User temp = new User { Username = "name", Email = "[email protected]", Password = "123" };
_Tests.MockStorage.Setup(s => s.GetCurrentUser()).Returns(_Tests.Storage.GetUser(u => u.Username == "panza"));
_Tests.Storage.CreateUser(temp);
_Tests.Storage.DeleteUser(u => u.Username == "name");
Assert.IsTrue(_Tests.Storage.GetUser(u => u.Username == "name") == null);
}
开发者ID:supermuk,项目名称:iudico,代码行数:11,代码来源:DeleteUser.cs
示例20: CreateUser
public void CreateUser()
{
User temp = new User { Username = "ipep", Email = "[email protected]", Password = "pass123" };
_Tests.MockStorage.Setup(s => s.GetCurrentUser()).Returns(_Tests.Storage.GetUser(u => u.Username == "panza"));
_Tests.Storage.CreateUser(temp);
User expected = _Tests.Storage.GetUser(u => u.Username == "ipep");
Assert.IsTrue(temp.Username == expected.Username && temp.Email == expected.Email);
}
开发者ID:supermuk,项目名称:iudico,代码行数:11,代码来源:CreateNewUser.cs
注:本文中的IUDICO.Common.Models.Shared.User类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论