public async Task CanCollectLogs() { var client = new LeanwareTestClient(_factory); var feature = (await client.Create <Feature>()).Received; var story = (await client.Create <Story>(new { FeatureId = feature.Id })).Received; await client.Post(path : $"api/features/{feature.Id}/approve"); await client.Post(path : $"api/stories/{story.Id}/start"); await client.Post(path : $"api/stories/{story.Id}/finish"); var storyUpdate = new { Title = RandomTitle("S") }; await client.Update <Story>(story.UpdatePath, storyUpdate); var logs = await client.Get <List <string> >(path : $"api/logs"); var assertedLogs = new[] { $"Feature #{feature.Id} has been created", $"Story #{story.Id} has been added to feature #{feature.Id}", $"Feature #{feature.Id} has been approved", $"Story #{story.Id} has been started", $"Story #{story.Id} has been finished", $"Feature #{feature.Id} has been finished", $"Story #{story.Id} has been updated" }; foreach (var al in assertedLogs) { logs.Should().Contain(al); } }
public async Task CanApproveNewFeatures() { var client = new LeanwareTestClient(_factory); var feature = (await client.Create <Feature>()).Received; var stories = new List <Story>(); for (int i = 0; i < 5; i++) { var story = (await client.Create <Story>(new { FeatureId = feature.Id })).Received; stories.Add(story); } var response = await client.Post(path : $"api/features/{feature.Id}/approve"); response.EnsureSuccessStatusCode(); feature = await client.Get <Feature>(feature.ReadPath); feature.Status.Should().Be("Approved"); foreach (var s in stories) { var story = await client.Get <Story>(s.ReadPath); story.Status.Should().Be("Approved"); } // Only New feature can be approved, otherwise HTTP 400 BadRequest should be returned response = await client.Post(path : $"api/features/{feature.Id}/approve"); response.StatusCode.Should().Be(HttpStatusCode.BadRequest); }
public async Task CanEnforceWipLimit() { const int wipLimit = 2; var client = new LeanwareTestClient(_factory); var stories = new List <Story>(); for (int i = 0; i < wipLimit + 1; i++) { var feature = (await client.Create <Feature>()).Received; var story = (await client.Create <Story>(new { FeatureId = feature.Id })).Received; stories.Add(story); await client.Post(path : $"api/features/{feature.Id}/approve"); } for (int i = 0; i < wipLimit; i++) { await client.Post(path : $"api/stories/{stories[i].Id}/start"); var story = await client.Get <Story>(stories[0].ReadPath); story.Status.Should().Be("Implementing"); } var response = await client.Post(path : $"api/stories/{stories[wipLimit].Id}/start"); response.StatusCode.Should().Be(HttpStatusCode.BadRequest, $"only {wipLimit} features can be in progress at the same time"); }
public async Task CanRenameTags() { var client = new LeanwareTestClient(_factory); var feature = (await client.Create <Feature>()).Received; var tag = feature.Tags.First(); var newTag = string.Join("", tag.Reverse()); await client.Post(path : $"api/tags/{tag}/renameTo/{newTag}"); feature = await client.Get <Feature>(feature.ReadPath); feature.Tags.Should().Contain(newTag); }
public async Task CanImplementStories() { var client = new LeanwareTestClient(_factory); var feature = (await client.Create <Feature>()).Received; var stories = new List <Story>(); for (int i = 0; i < 5; i++) { var s = (await client.Create <Story>(new { FeatureId = feature.Id })).Received; stories.Add(s); } var response = await client.Post(path : $"api/stories/{stories[0].Id}/start"); response.StatusCode.Should().Be(HttpStatusCode.BadRequest, "only approved stories can be implemented"); await client.Post(path : $"api/features/{feature.Id}/approve"); response = await client.Post(path : $"api/stories/{stories[0].Id}/finish"); response.StatusCode.Should().Be(HttpStatusCode.BadRequest, "story cannot be finished without being started first"); response = await client.Post(path : $"api/stories/{stories[0].Id}/start"); response.EnsureSuccessStatusCode(); feature = await client.Get <Feature>(feature.ReadPath); feature.Status.Should().Be("Implementing"); var story = await client.Get <Story>(stories[0].ReadPath); story.Status.Should().Be("Implementing"); response = await client.Post(path : $"api/stories/{story.Id}/finish"); response.EnsureSuccessStatusCode(); feature = await client.Get <Feature>(feature.ReadPath); feature.Status.Should().Be("Implementing"); story = await client.Get <Story>(story.ReadPath); story.Status.Should().Be("Implemented"); for (int i = 1; i < stories.Count; i++) { await client.Post(path : $"api/stories/{stories[i].Id}/start"); await client.Post(path : $"api/stories/{stories[i].Id}/finish"); } feature = await client.Get <Feature>(feature.ReadPath); feature.Status.Should().Be("Implemented", "when all stories are implemented, feature is automatically set to implemented too"); var additionalStory = (await client.Create <Story>(new { FeatureId = feature.Id })).Received; additionalStory.Status.Should().Be("Approved", "when new story is added to implemented feature, it is considered approved by default"); feature = await client.Get <Feature>(feature.ReadPath); feature.Status.Should().Be("ChangeRequested"); }