Beispiel #1
0
        public void CanCustomizeObjectUsingMultipleCustomizations()
        {
            var obj = new SampleClass();
            Customization<SampleClass> greet = x => x.Text = "Hello, ";
            Customization<SampleClass> world = x => x.Text += "World!";

            obj.Customize(greet, world);

            obj.Text.Should().Be("Hello, World!");
        }
Beispiel #2
0
        public void CustomizeObjectUsingNullFails()
        {
            var obj = new SampleClass();

            var exception = Record.Exception(
                () => obj.Customize(null));

            exception.Should().BeOfType<NullReferenceException>();
        }
Beispiel #3
0
        public void CustomizeObjectWithOneOfTheCustomizationsBeingNullFails()
        {
            var obj = new SampleClass();
            var arrayOfCustomizationsContainingNull = new Customization<SampleClass>[] {null};

            var exception = Record.Exception(
                () => obj.Customize(arrayOfCustomizationsContainingNull));

            exception.Should().BeOfType<NullReferenceException>();
        }
Beispiel #4
0
        public void CustomizeObjectReturnsSameObject()
        {
            var obj = new SampleClass();

            var resultObj = obj.Customize(x => x.Text = "foo bar");

            resultObj.Should().BeSameAs(obj);
        }