public void ShouldHaveNoMembersWhenClearingAllMembers()
        {
            dynamic entity = new DynamicEntity();
            entity.Name = "Jane Doe";
            entity.Age = 32;

            entity.Clear();
            Then.MemberExists = entity.TestForMember("Name");
            Then.Count = entity.Count();

            Then.MemberExists.Should().BeFalse("all properties were cleared");
            Then.MemberExists = entity.TestForMember("Age");
            Then.MemberExists.Should().BeFalse("all properties were cleared");
            Then.Count.Should().Be(0);
        }
        public void ShouldHaveDynamicPropertyWhenAssignedValue()
        {
            dynamic entity = new DynamicEntity();
            entity.Name = "Jane Doe";

            Then.Entity = entity;
            Then.String = entity.Name;
            Then.Count = entity.Count();

            Then.Entity.Should().NotBeNull().And.BeAssignableTo<DynamicEntity>();
            Then.String.Should().Be("Jane Doe");
            Then.Count.Should().Be(1);
            bool exists = entity.TestForMember("Name");
            exists.Should().BeTrue();
        }
        public void ShouldReturnNullWhenAccessingNonExistentPropertyGivenMissingMemberBehaviorReturnsNull()
        {
            dynamic entity = new DynamicEntity(MissingMemberBehavior.ReturnsNull);

            Then.String = entity.Name;

            Then.String.Should().BeNull();
        }
        public void ShouldHaveValidObjectWhenCreating()
        {
            dynamic entity = new DynamicEntity();

            Then.Entity = entity;

            Then.Entity.Should().NotBeNull().And.BeAssignableTo<DynamicEntity>();
        }
        public void ShouldUseRegisteredConverterWhenConvertingToKnownType()
        {
            dynamic entity = new DynamicEntity(MissingMemberBehavior.ThrowException, new DictionaryConverter());
            entity.Name = "Jane Doe";

            Then.Dictionary = entity;

            Then.Dictionary.Should().NotBeNull().And.HaveCount(1);
        }
        public void ShouldThrowExceptionWhenConvertingToUnexpectedType()
        {
            dynamic entity = new DynamicEntity();

            Then.String = entity;
        }
 public void ShouldThrowExceptionWhenAccessingNonExistentProperty()
 {
     dynamic entity = new DynamicEntity();
     Then.String = entity.Name;
 }