public void Build_WithHardcodedComponentType_ReturnsExpectedSpecElement() { // Arrange var hardCodedCompType = "Hardcoded"; var unbuilt = new ComponentTypeAndFieldUnbuiltSearchSpecElement <Employee>(); unbuilt.SetHardcodedComponentType(hardCodedCompType); // Act var spec = unbuilt.Build(new Employee()); // Assert Assert.True(spec is ComponentTypeAndFieldSearchSpecElement); var cfe = (ComponentTypeAndFieldSearchSpecElement)spec; Assert.Equal(hardCodedCompType, cfe.ComponentType); }
public void Build_WithHardcodedComponentTypeAndLambda_LambdaTakesPrecedence() { // Arrange var hardCodedCompType = "Hardcoded"; var unbuilt = new ComponentTypeAndFieldUnbuiltSearchSpecElement <Employee>(); unbuilt.SetComponentTypeGetter(e => "Employee"); unbuilt.SetHardcodedComponentType(hardCodedCompType); var employee = new Employee { Name = "Dole Duck", Age = 12 }; // Act var spec = unbuilt.Build(employee); // Assert Assert.True(spec is ComponentTypeAndFieldSearchSpecElement); var cfe = (ComponentTypeAndFieldSearchSpecElement)spec; Assert.Equal("Employee", cfe.ComponentType); }