コード例 #1
0
        public void Be_Creatable()
        {
            var sut = new AggregateProvideSuggestions(Enumerable.Empty <IProvideSuggestions>());

            sut.Should().NotBeNull();
            sut.Should().BeAssignableTo <IProvideSuggestions>();
        }
コード例 #2
0
        public void Handle_Null_Result()
        {
            var p1 = Substitute.For <IProvideSuggestions>();

            p1.For(Arg.Any <string>(), Arg.Any <string>())
            .ReturnsForAnyArgs(new[] { "A", "B" });
            var p2 = Substitute.For <IProvideSuggestions>();

            p2.For(Arg.Any <string>(), Arg.Any <string>())
            .ReturnsForAnyArgs((string[])null);

            var sut = new AggregateProvideSuggestions(new[] { p1, p2 });

            var sug = sut.For("jo", "cs").ToArray();

            p1.Received(1).For(Arg.Any <string>(), Arg.Any <string>());
            p2.Received(1).For(Arg.Any <string>(), Arg.Any <string>());

            sug.Should().Contain("A");
            sug.Should().Contain("B");
        }