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(); }