本文整理汇总了C#中SirenOfShame.Lib.Settings.PersonSetting类的典型用法代码示例。如果您正苦于以下问题:C# PersonSetting类的具体用法?C# PersonSetting怎么用?C# PersonSetting使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PersonSetting类属于SirenOfShame.Lib.Settings命名空间,在下文中一共展示了PersonSetting类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HowManyTimesHasPerformedBackToBackBuildsAcrossBuilds
public static int HowManyTimesHasPerformedBackToBackBuildsAcrossBuilds(PersonSetting activePerson, IEnumerable<BuildStatus> allActiveBuildDefinitionsOrderedChronoligically)
{
return allActiveBuildDefinitionsOrderedChronoligically
.GroupBy(i => i.BuildDefinitionId)
.Select(i => HowManyTimesHasPerformedBackToBackBuildsForABuild(activePerson, i))
.Aggregate(0, (i, j) => i + j);
}
示例2: AvatarPicker
public AvatarPicker(ImageList avatarImageList, PersonSetting personSetting)
{
_imageService = new ImageService();
_okToClose = true;
_avatarImageList = avatarImageList;
_personSetting = personSetting;
InitializeComponent();
emailTextbox.Text = personSetting.Email;
if (personSetting.Email != null)
{
_gravatar.SetImage(personSetting, avatarImageList);
tabControl1.SelectedIndex = 1;
}
if (personSetting.AvatarImageName != null)
{
_croppedCustom.ImageLocation = Path.Combine(SirenOfShameSettings.GetAvatarsFolder(),
personSetting.AvatarImageName);
tabControl1.SelectedIndex = 2;
}
int avatarCount = SirenOfShameSettings.AVATAR_COUNT;
for (int i = 0; i < avatarCount; i++)
{
Avatar avatar = new Avatar();
avatar.SetImage(i, avatarImageList);
avatar.Click += AvatarOnClick;
flowLayoutPanel1.Controls.Add(avatar);
}
}
示例3: HowManyTimesHasPerformedBackToBackBuildsForABuild
public static int HowManyTimesHasPerformedBackToBackBuildsForABuild(PersonSetting activePerson, IEnumerable<BuildStatus> currentBuildDefinitionOrderedChronoligically) {
BuildStatus lastBuild = null;
int backToBack = 0;
foreach (var buildStatus in currentBuildDefinitionOrderedChronoligically)
{
bool lastBuildWasByActivePerson = lastBuild != null && lastBuild.RequestedBy == activePerson.RawName;
bool currentBuildIsByActivePerson = buildStatus.RequestedBy == activePerson.RawName;
if (lastBuildWasByActivePerson && currentBuildIsByActivePerson)
{
bool lastBuildPassed = lastBuild.BuildStatusEnum == BuildStatusEnum.Working;
bool currentBuildPassed = buildStatus.BuildStatusEnum == BuildStatusEnum.Working;
bool wereBackToBack = lastBuild.IsBackToBackWithNextBuild(buildStatus);
if (lastBuildPassed && currentBuildPassed && wereBackToBack)
{
backToBack++;
}
}
lastBuild = buildStatus;
}
_log.Debug(activePerson.RawName + " has achieved back to back successful builds " + backToBack + " times");
return backToBack;
}
示例4: CalculateLowestBuildRatioAfter50Builds
public static double? CalculateLowestBuildRatioAfter50Builds(PersonSetting personSetting, IEnumerable<BuildStatus> allActiveBuildDefinitionsOrderedChronoligically)
{
int totalBuilds = 0;
int unsuccessfulBuilds = 0;
double lowestRatio = 0.0;
List<BuildStatus> buildStatuses = allActiveBuildDefinitionsOrderedChronoligically
.Where(i => i.RequestedBy == personSetting.RawName)
.ToList();
if (buildStatuses.Count < 50) return null;
double currentRatio = 0;
DateTime? lowestRatioAchieved = null;
foreach (var buildStatus in buildStatuses)
{
totalBuilds++;
if (buildStatus.BuildStatusEnum == BuildStatusEnum.Broken)
unsuccessfulBuilds++;
currentRatio = (double)unsuccessfulBuilds / totalBuilds;
if (totalBuilds == 50)
{
lowestRatio = currentRatio;
lowestRatioAchieved = buildStatus.StartedTime;
}
if (totalBuilds > 50)
{
var oldLowestRatio = lowestRatio;
lowestRatio = Math.Min(currentRatio, lowestRatio);
if (Math.Abs(oldLowestRatio - lowestRatio) > .001)
{
lowestRatioAchieved = buildStatus.StartedTime;
}
}
}
_log.Debug(string.Format("{0}'s lowest build ratio is {1:p}. They achieved it on {3:d}. Their current ratio is {2:p}", personSetting.RawName, lowestRatio, currentRatio, lowestRatioAchieved));
return lowestRatio;
}
示例5: CalculateCurrentBuildRatio
public static double CalculateCurrentBuildRatio(PersonSetting personSetting, IEnumerable<BuildStatus> allActiveBuildDefinitionsOrderedChronoligically)
{
var currentUserBuilds = allActiveBuildDefinitionsOrderedChronoligically.Where(i => i.RequestedBy == personSetting.RawName).ToList();
var totalBuilds = currentUserBuilds.Count;
var unsuccessfulBuilds = currentUserBuilds.Count(i => i.BuildStatusEnum == BuildStatusEnum.Broken);
return totalBuilds == 0 ? 0 : (double)unsuccessfulBuilds/totalBuilds;
}
示例6: CalculateSuccessInARow
public static int CalculateSuccessInARow(PersonSetting personSetting, IEnumerable<BuildStatus> allActiveBuildDefinitionsOrderedChronoligically)
{
return allActiveBuildDefinitionsOrderedChronoligically
.Reverse()
.Where(i => i.RequestedBy == personSetting.RawName)
.TakeWhile(i => i.BuildStatusEnum != BuildStatusEnum.Broken)
.Count();
}
示例7: WasJustLikeLightning_ZeroBuilds
public void WasJustLikeLightning_ZeroBuilds()
{
var fakePersonSetting = new PersonSetting { RawName = "currentUser" };
var builds = new List<BuildStatus>
{
};
Assert.AreEqual(false, new LikeLightning(fakePersonSetting, builds).HasJustAchieved());
}
示例8: OnlyOnePersonOnProject
public void OnlyOnePersonOnProject()
{
PersonSetting personSetting = new PersonSetting { RawName = "currentUser", TotalBuilds = 110, FailedBuilds = 0 };
var people = new List<PersonSetting> {
personSetting,
};
Assert.IsFalse(new Napoleon(personSetting, people).HasJustAchieved());
}
示例9: RefreshStats
public void RefreshStats(PersonSetting person)
{
_reputation.Text = person.GetReputation().ToString(CultureInfo.InvariantCulture);
_achievements.Text = person.Achievements.Count.ToString(CultureInfo.InvariantCulture);
_failPercent.Text = string.Format("{0:p1}", person.CurrentBuildRatio).Replace(" ", "");
_successfulBuildsInARow.Text = string.Format("{0}", person.CurrentSuccessInARow);
_fixedSomeoneElsesBuild.Text = string.Format("{0}", person.NumberOfTimesFixedSomeoneElsesBuild);
_totalBuilds.Text = string.Format("{0}", person.TotalBuilds);
}
示例10: GetBothDisplayAndRawNames_RawNameNoDisplayName_OnlyShowsRawName
public void GetBothDisplayAndRawNames_RawNameNoDisplayName_OnlyShowsRawName()
{
var personSetting = new PersonSetting
{
RawName = "dev\\lrichard",
DisplayName = "dev\\lrichard"
};
Assert.AreEqual("dev\\lrichard", personSetting.GetBothDisplayAndRawNames());
}
示例11: GetBothDisplayAndRawNames_DisplayNameAndRawName_DisplaysBoth
public void GetBothDisplayAndRawNames_DisplayNameAndRawName_DisplaysBoth()
{
var personSetting = new PersonSetting
{
RawName = "dev\\lrichard",
DisplayName = "Lee Richardson"
};
Assert.AreEqual("Lee Richardson (dev\\lrichard)", personSetting.GetBothDisplayAndRawNames());
}
示例12: OnlyOneBuild
public void OnlyOneBuild()
{
PersonSetting personSetting = new PersonSetting {RawName = "currentUser"};
List<BuildStatus> builds = new List<BuildStatus>
{
new BuildStatus { RequestedBy = "currentUser", StartedTime = new DateTime(2010, 1, 1, 1, 1, 59), BuildStatusEnum = BuildStatusEnum.Working },
};
Assert.IsFalse(new AndGotAwayWithIt(personSetting, builds).HasJustAchieved());
}
示例13: SirenNeverBeenConnected
public void SirenNeverBeenConnected()
{
PersonSetting personSetting = new PersonSetting { RawName = "currentUser" };
SirenOfShameSettings settings = new SirenOfShameSettings(false)
{
SirenEverConnected = false,
MyRawName = "currentUser"
};
Assert.AreEqual(false, new ShamePusher(personSetting, settings).HasJustAchieved());
}
示例14: BrokenThenFixed_BothByCurrentUser_ButWithin60Seconds_
public void BrokenThenFixed_BothByCurrentUser_ButWithin60Seconds_()
{
PersonSetting personSetting = new PersonSetting {RawName = "currentUser"};
List<BuildStatus> builds = new List<BuildStatus>
{
new BuildStatus { RequestedBy = "currentUser", FinishedTime = new DateTime(2010, 1, 1, 1, 1, 1), BuildStatusEnum = BuildStatusEnum.Broken },
new BuildStatus { RequestedBy = "currentUser", StartedTime = new DateTime(2010, 1, 1, 1, 2, 1), BuildStatusEnum = BuildStatusEnum.Working },
};
Assert.IsFalse(new AndGotAwayWithIt(personSetting, builds).HasJustAchieved());
}
示例15: CurrentUserHas99MorePointsThanAnyoneElse
public void CurrentUserHas99MorePointsThanAnyoneElse()
{
PersonSetting personSetting = new PersonSetting { RawName = "currentUser", TotalBuilds = 110, FailedBuilds = 0 };
var people = new List<PersonSetting> {
personSetting,
new PersonSetting { RawName = "someoneElse", TotalBuilds = 11, FailedBuilds = 0 },
new PersonSetting { RawName = "someoneElseElse", TotalBuilds = 5, FailedBuilds = 0 },
};
Assert.IsFalse(new Napoleon(personSetting, people).HasJustAchieved());
}