Example #1
0
        public void ShouldHavePropery()
        {
            dynamic person = new ExpandoObject();

            person.Name = "Sarah";
            DynamicShould.HaveProperty(person, "Name");
        }
Example #2
0
        public void MultiLineHavePropertyScenario_MaximumLinesShouldFail()
        {
            dynamic testDynamicObject = new ExpandoObject();

            testDynamicObject.Bar = "BarPropertyValue";
            Verify.ShouldFail(() =>
                              DynamicShould
                              .HaveProperty
                              (
                                  testDynamicObject,
                                  "foo",
                                  "Some additional context"
                              ),

                              errorWithSource:
                              @"Dynamic object ""testDynamicObject"" should contain property ""foo"" but does not." + @"

Additional Info:
    Some additional context",

                              errorWithoutSource:
                              @"Dynamic object should contain property ""foo"" but does not." + @"

Additional Info:
    Some additional context");
        }
        protected override void ShouldPass()
        {
            dynamic testDynamicObject = new ExpandoObject();

            testDynamicObject.Foo = "FooPropertyValue";
            DynamicShould.HaveProperty(testDynamicObject, "Foo");
        }
        protected override void ShouldThrowAWobbly()
        {
            dynamic testDynamicObject = new ExpandoObject();

            testDynamicObject.Bar = "BarPropertyValue";
            DynamicShould
            .HaveProperty(testDynamicObject, "foo");
        }
Example #5
0
        protected override void ShouldThrowAWobbly()
        {
            dynamic testDynamicObject = new Foo();

            testDynamicObject.Bar = "BarPropertyValue";
            DynamicShould
            .HaveProperty(testDynamicObject, "foo", "Some additional context");
        }
Example #6
0
 public void HaveProperty()
 {
     DocExampleWriter.Document(() =>
     {
         dynamic theFuture = new ExpandoObject();
         DynamicShould.HaveProperty(theFuture, "RobotTeachers");
     }, _testOutputHelper);
 }
Example #7
0
        public void ThenCurrentUserDetailsShouldBeReturned()
        {
            DynamicShould.HaveProperty(_result, "EMail");
            DynamicShould.HaveProperty(_result, "Name");
            DynamicShould.HaveProperty(_result, "UserName");

            (_result.EMail as string).ShouldBe("*****@*****.**");
            (_result.Name as string).ShouldBe("123 456");
            (_result.UserName as string).ShouldBe("123456");

            //todo should be
            //_result.EMail.ShouldBe(_userName + "@realtimeweb.net");
            //_result.Name.ShouldBe(_userName);
            //_result.UserName.ShouldBe(_userName);
        }
        public void HavePropertyNonDynamicScenarioShouldFail()
        {
            dynamic testDynamicObject = new Foo();

            testDynamicObject.Bar = "BarPropertyValue";

            Verify.ShouldFail(() =>
                              DynamicShould
                              .HaveProperty(testDynamicObject, "foo", "Some additional context"),

                              errorWithSource:
                              @"Dynamic object ""testDynamicObject"" should contain property ""foo"" but does not." + @"
Additional Info:
Some additional context",

                              errorWithoutSource:
                              @"Dynamic object ""testDynamicObject"" should contain property ""foo"" but does not." + @"
Additional Info:
Some additional context");
        }
        public void ShouldPass()
        {
            dynamic testDynamicObject = new Foo();

            DynamicShould.HaveProperty(testDynamicObject, "Bar");
        }
        protected override void ShouldPass()
        {
            dynamic testDynamicObject = new Foo();

            DynamicShould.HaveProperty(testDynamicObject, "Bar");
        }