コード例 #1
0
        /// <summary>
        /// Checks the build matches what would be emitted by our test build driver
        /// </summary>
        private void VerifyBuild(CharacterBuildModel build, string name, int level, params string[] choices)
        {
            build.Build.Name.Should().Be(name);
            build.Build.Level.Should().Be(level);
            build.Build.Summary.Should().Be(string.Join(" ", choices));

            var sheet = build.BuildOutput.CreateCharacterSheet().ToList();

            sheet.Should().HaveCount(choices.Length + 1);

            var basics = sheet[0].Items.ToList();

            basics.Should().Contain(l => l.Item1 == "Name" && l.Item2 == name);
            basics.Should().Contain(l => l.Item1 == "Level" && l.Item2 == $"{level}");

            for (int i = 0; i < choices.Length; ++i)
            {
                sheet[i + 1].Items.ToList().Should().HaveCount(1);
                var entry = sheet[i + 1].Items[0];
                entry.Item1.Should().Be("Option");
                entry.Item2.Should().Be(choices[i]);
            }
        }
コード例 #2
0
        private async Task <CharacterBuildModel> BuildAsync(CharacterBuildService service, ClaimsPrincipal user, CharacterBuildModel model, params string[] choices)
        {
            if (choices.Length == 0)
            {
                return(model);
            }

            var newModel = await service.BuildAsync(user, model, choices[0]);

            newModel.Should().NotBeNull();
            return(await BuildAsync(service, user, newModel, choices.Skip(1).ToArray()));
        }