Example #1
0
            public void Should_Add_SetRequiredCommand_When_SetRequired()
            {
                var builder = new MemberSpecificationBuilder <object, object>();

                builder.SetRequired("message");

                Assert.Single(builder.Commands);
                Assert.IsType <SetRequiredCommand>(builder.Commands.Single());

                var command = (SetRequiredCommand)builder.Commands.Single();

                Assert.Equal("SetRequired", command.Name);
            }
Example #2
0
        public void Should_Add_SetRequired_When_SetRequired_ReferenceType()
        {
            var builderInterface = new MemberSpecificationBuilder <object, MemberClass>() as
                                   IMemberSpecificationBuilder <object, MemberClass>;

            builderInterface.SetRequired("error");

            var builder = (MemberSpecificationBuilder <object, MemberClass>)builderInterface;

            Assert.Single(builder.Commands);
            Assert.IsType <SetRequiredCommand>(builder.Commands.Single());

            var setRequiredCommand = (SetRequiredCommand)builder.Commands.Single();

            Assert.Equal("error", setRequiredCommand.Message);
        }
Example #3
0
            public void Should_ThrowException_When_SetRequired_With_NullMessage()
            {
                var builder = new MemberSpecificationBuilder <object, object>();

                Assert.Throws <ArgumentNullException>(() => { builder.SetRequired(null); });
            }