public void GivenExistingType_WhenConstructorWithParameterIsInvoked_ThenThatTypeShouldBeReflected(Type reflectedType) { // Arrange // Act var builder = new IgnoreVirtualMembersSpecimenBuilder(reflectedType); // Assert builder.ReflectedType.Should().BeSameAs(reflectedType); }
public void GivenDefaultConstructor_WhenInvoked_ThenReflectedTypeShouldBeNull() { // Arrange // Act var builder = new IgnoreVirtualMembersSpecimenBuilder(); // Assert builder.ReflectedType.Should().BeNull(); }
public void GivenNotPropertyInfoRequest_WhenCreateInvoked_ThenNoSpecimenInstance( [Modest] IgnoreVirtualMembersSpecimenBuilder builder) { // Arrange // Act var specimen = builder.Create(new object(), this.context); // Assert specimen.Should().BeOfType <NoSpecimen>(); }
public void GivenUninitializedRequest_WhenCreateInvoked_ThenNoSpecimenInstance( [Modest] IgnoreVirtualMembersSpecimenBuilder builder) { // Arrange // Act var specimen = builder.Create(null, this.context); // Assert specimen.Should().BeOfType <NoSpecimen>(); }
public void GivenNotVirtualPropertyInfoRequest_WhenCreateInvoked_ThenNoSpecimenInstance( [Modest] IgnoreVirtualMembersSpecimenBuilder builder) { // Arrange var notVirtualPropertyInfo = typeof(FakeObject).GetProperty(nameof(FakeObject.NotVirtualProperty)); // Act var specimen = builder.Create(notVirtualPropertyInfo, this.context); // Assert specimen.Should().BeOfType <NoSpecimen>(); }
public void GivenVirtualPropertyInfoRequest_WhenCreateInvoked_ThenNoSpecimenInstance() { // Arrange var builder = new IgnoreVirtualMembersSpecimenBuilder(); var virtualPropertyInfo = typeof(FakeObject).GetProperty(nameof(FakeObject.VirtualProperty)); // Act var specimen = builder.Create(virtualPropertyInfo, this.context); // Assert specimen.Should().BeNull(); }
public void GivenVirtualPropertyInfoRequestHostedInAppropriateType_WhenCreateInvoked_ThenOmitSpecimenInstance() { // Arrange var reflectedType = typeof(FakeObject); var builder = new IgnoreVirtualMembersSpecimenBuilder(reflectedType); var virtualPropertyInfo = reflectedType.GetProperty(nameof(FakeObject.VirtualProperty)); // Act var specimen = builder.Create(virtualPropertyInfo, this.context); // Assert specimen.Should().BeOfType <OmitSpecimen>(); }
public void GivenVirtualPropertyInfoRequestHostedInDifferentType_WhenCreateInvoked_ThenNoSpecimenInstance( [Frozen] Type reflectedType, [Greedy] IgnoreVirtualMembersSpecimenBuilder builder) { // Arrange var virtualPropertyInfo = typeof(FakeObject).GetProperty(nameof(FakeObject.VirtualProperty)); // Act var specimen = builder.Create(virtualPropertyInfo, this.context); // Assert builder.ReflectedType.Should().BeSameAs(reflectedType); specimen.Should().BeOfType <NoSpecimen>(); }