public void OpenHandler_WhenEventApplied_SetsAllValues() { var solution = new Solution(Guid.Empty, "solution"); var version = new AppVersion(Guid.Empty, "version"); var build = new Build(Guid.Empty, "build"); string title = "title", description = "description", steps = "steps", expected = "expected", actual = "actual"; OpenIssue.Opening += EventApplier; DateTimeOffset now = 12.November(2011).At(t => t.MidNight).In(TimeSpan.Zero); OpenIssue open = null; HappeningIn(now, () => { open = Issue.Open(solution, version, build, title, description, steps, expected, actual); }); Assert.That(open.Solution, Is.SameAs(solution)); Assert.That(open.Version, Is.SameAs(version)); Assert.That(open.Build, Is.SameAs(build)); Assert.That(open.Title, Is.EqualTo(title)); Assert.That(open.Description, Is.EqualTo(description)); Assert.That(open.StepsToReproduce, Is.EqualTo(steps)); Assert.That(open.ExpectedResult, Is.EqualTo(expected)); Assert.That(open.ActualResult, Is.EqualTo(actual)); Assert.That(open.Opened, Is.EqualTo(now)); }
// not virtual as is called from the ctor protected void OnOpening(Guid id, Solution solution, AppVersion version, Build build, string title, string description, string stepsToReproduce, string expectedResult, string actualResult, DateTimeOffset opened) { DomainEventHandler<IssueOpened> handler = Opening; if (handler != null) handler(this, new DomainEventEventArgs<IssueOpened>( new IssueOpened(id) { Solution = solution, Version = version, Build = build, Title = title, Description = description, StepsToReproduce = stepsToReproduce, ExpectedResult = expectedResult, ActualResult = actualResult, Opened = opened }, doOpen)); }
// not virtual as is called from the ctor protected void OnFixing(AppVersion versionFixed, Build buildFixed, string resolution, DateTimeOffset @fixed) { DomainEventHandler<IssueFixed> handler = Fixing; if (handler != null) handler(this, new DomainEventEventArgs<IssueFixed>( new IssueFixed(Id) { VersionFixed = versionFixed, BuildFixed = buildFixed, Resolution = resolution, Fixed = @fixed }, doFix)); }
internal FixedIssue(OpenIssue self, AppVersion versionFixed, Build buildFixed, string resolution) : base(self.Id, self.Solution, self.Version, self.Build, self.Title, self.Description) { StepsToReproduce = self.StepsToReproduce; ExpectedResult = self.ExpectedResult; ActualResult = self.ActualResult; Opened = self.Opened; OnFixing(versionFixed, buildFixed, resolution, Time.UtcNow); }
protected Issue(Guid id, Solution solution, AppVersion version, Build build, string title, string description) { Id = id; Solution = solution; Version = version; Build = build; Title = title; Description = description; }
public void Open_RaisesEvent() { var solution = new Solution(Guid.Empty, "solution"); var version = new AppVersion(Guid.Empty, "version"); var build = new Build(Guid.Empty, "build"); string title = "title", description = "description", steps = "steps", expected = "expected", actual = "actual"; bool raised = false; OpenIssue.Opening += (sender, e) => { raised = true; }; Issue.Open(solution, version, build, title, description, steps, expected, actual); Assert.That(raised, Is.True); }
public void Fix_RaisesEvent() { AppVersion fixingVersion = new AppVersion(Guid.Empty, "fix"); Build fixingBuild = new Build(Guid.Empty, "fix"); string resolution = "resolution"; bool raised = false; FixedIssue.Fixing += (sender, e) => { raised = true; }; Issue.Open(null, null, null, null, null, null, null, null) .Fix(fixingVersion, fixingBuild, resolution); Assert.That(raised, Is.True); }
public void Fix_WhenEventApplied_SetsAllValues() { AppVersion fixingVersion = new AppVersion(Guid.Empty, "fix"); Build fixingBuild = new Build(Guid.Empty, "fix"); string resolution = "resolution"; FixedIssue.Fixing += EventApplier; DateTimeOffset now = 12.November(2011).At(t => t.MidNight).In(TimeSpan.Zero); FixedIssue @fixed = null; HappeningIn(now, () => { @fixed = Issue.Open(null, null, null, null, null, null, null, null) .Fix(fixingVersion, fixingBuild, resolution); }); Assert.That(@fixed.VersionFixed, Is.SameAs(fixingVersion)); Assert.That(@fixed.BuildFixed, Is.SameAs(fixingBuild)); Assert.That(@fixed.Resolution, Is.EqualTo(resolution)); Assert.That(@fixed.Fixed, Is.EqualTo(now)); }
public void Fix_OnItsOwn_OnlySetsMandatoryValues() { AppVersion fixingVersion = new AppVersion(Guid.Empty, "fix"); Build fixingBuild = new Build(Guid.Empty, "fix"); string resolution = "resolution"; DateTimeOffset now = 12.November(2011).At(t => t.MidNight).In(TimeSpan.Zero); FixedIssue @fixed = null; HappeningIn(now, () => { @fixed = Issue.Open(null, null, null, null, null, null, null, null) .Fix(fixingVersion, fixingBuild, resolution); }); Assert.That(@fixed.VersionFixed, Is.Null); Assert.That(@fixed.BuildFixed, Is.Null); Assert.That(@fixed.Resolution, Is.Null); Assert.That(@fixed.Fixed, Is.EqualTo(default(DateTimeOffset))); }
protected internal OpenIssue(Solution solution, AppVersion version, Build build, string title, string description, string stepsToReproduce, string expectedResult, string actualResult) : base(solution, version, build, title, description) { OnOpening(Comb.Generate(), solution, version, build, title, description, stepsToReproduce, expectedResult, actualResult, Time.UtcNow); }
public FixedIssue Fix(AppVersion versionFixed, Build buildFixed, string resolution) { return new FixedIssue(this, versionFixed, buildFixed, resolution); }
protected Issue(Solution solution, AppVersion version, Build build, string title, string description) : this(Comb.Generate(), solution, version, build, title, description) { }
public static OpenIssue Open(Solution solution, AppVersion version, Build build, string title, string description, string stepsToReproduce, string expectedResult, string actualResult) { return new OpenIssue(solution, version, build, title, description, stepsToReproduce, expectedResult, actualResult); }