示例#1
0
        public void Shrunk()
        {
            var something = Generate.One <SomethingToShrink>();

            something.IntProperty = 42;
            var composite =
                new ShrinkingStrategy()
                .Add(Simple.AllValues())
                .Register(something, e => e.IntProperty)
                .Register(something, e => e.StringProperty);

            composite.Shrink(() => something.IntProperty == 42);

            Assert.False(composite.Shrunk());
            Assert.False(composite.Shrunk(something, e => e.IntProperty));
            Assert.True(composite.Shrunk(something, e => e.StringProperty));
        }
        public void TwoOutOfThree()
        {
            var something =
                new SomethingToShrink
            {
                PropertyOne   = 42,
                PropertyTwo   = 42,
                PropertyThree = 42,
            };
            var composite =
                new ShrinkingStrategy()
                .Add(Simple.AllValues())
                .RegisterAll(something);

            composite.Shrink(() => something.PropertyOne == 42 && something.PropertyTwo == 42);

            Assert.False(composite.Shrunk());
            Assert.False(composite.Shrunk(something, e => e.PropertyOne));
            Assert.False(composite.Shrunk(something, e => e.PropertyTwo));
            Assert.True(composite.Shrunk(something, e => e.PropertyThree));
        }