public void SunnyDayFlowTest() { var sut = new WorkflowService(_repository); // Draft var draft = sut.CreateDraft(someData, draftAuthor).Value; var configurationId = draft.Id; AssertDraft(draft.Id); // Planned sut.Schedule(draft.Id.AsGuid(), plannedAuthor, goLive); AssertPlanned(configurationId); // Live sut.GoLive(configurationId.AsGuid(), liveAuthor); AssertLive(configurationId); // Archive sut.Archive(configurationId.AsGuid(), archiveAuthor); AssertArchive(configurationId); // End flow assertion AssertRawData(configurationId); }
public void SunnyDayFlowTest() { var repository = new ConfigurationRepository(); var sut = new WorkflowService(repository); const string someData = "Some data"; var draftId = sut.CreateDraft(someData, "Raf"); var draft = repository.GetDraft(draftId); draft.Data.Should().Be(someData); draft.Author.Should().Be("Raf"); draft.CreationDate.Should().BeCloseTo(DateTime.UtcNow); var goLive = DateTime.UtcNow.AddDays(1); var plannedId = sut.Schedule(draftId, "Tom", goLive); var planned = repository.GetPlanned(plannedId); planned.Data.Should().Be(someData); planned.Author.Should().Be("Tom"); planned.CreationDate.Should().BeCloseTo(DateTime.UtcNow); planned.WhenGoLive.Should().Be(goLive); var goLiveId = sut.GoLive(plannedId, "Alice"); var live = repository.GetLive(goLiveId); live.Data.Should().Be(someData); live.Author.Should().Be("Alice"); live.CreationDate.Should().BeCloseTo(DateTime.UtcNow); var archivedId = sut.Archive(goLiveId, "Bob"); var archived = repository.GetArchived(archivedId); archived.Data.Should().Be(someData); archived.Author.Should().Be("Bob"); archived.CreationDate.Should().BeCloseTo(DateTime.UtcNow); var dataRow = repository.Get(archivedId); dataRow.Status.Should().Be(ConfigStatus.Archived); dataRow.DraftAuthor.Should().Be("Raf"); dataRow.PlannedAuthor.Should().Be("Tom"); dataRow.LiveAuthor.Should().Be("Alice"); dataRow.WhenGoLive.Should().Be(goLive); dataRow.ArchivedAuthor.Should().Be("Bob"); }