public void SimpleParameter_Create() { // Arrange var mockPathAssembler = new FieldPathAssemblerStub(); var assemblerUnderTest = new SimpleParameterAssembler(mockPathAssembler); var p = new SimpleParameter(FieldPathAssemblerStub.Source, "=", 1); // Act var restored = assemblerUnderTest.Create(p); // Assert Assert.IsNotNull(restored); Assert.IsInstanceOf<SimpleParameterDTO>(restored); var dto = (SimpleParameterDTO)restored; Assert.AreSame(FieldPathAssemblerStub.DTO, dto.Path); Assert.AreEqual(p.Operator, dto.Operator); Assert.AreEqual(p.Value, dto.Value); }
public void SimpleParameter_Create() { // Arrange var mockPath = MockRepository.GenerateMock<FieldPath>(); var mockPathDTO = MockRepository.GenerateMock<FieldPathDTO>(); var mockPathAssembler = MockRepository.GenerateMock<FieldPathAssembler>((IConfiguration)null); mockPathAssembler.Stub(x => x.Create(mockPath)).Return(mockPathDTO); var assemblerUnderTest = new SimpleParameterAssembler(mockPathAssembler); var p = new SimpleParameter(mockPath, "=", 1); // Act var restored = assemblerUnderTest.Create(p); // Assert Assert.IsNotNull(restored); Assert.IsInstanceOf<SimpleParameterDTO>(restored); var dto = (SimpleParameterDTO)restored; Assert.AreSame(mockPathDTO, dto.Path); Assert.AreEqual(p.Operator, dto.Operator); Assert.AreEqual(p.Value, dto.Value); mockPathAssembler.VerifyAllExpectations(); }
protected IParameter GetParameters() { IParameter p = DerivedFrom.CustomParameters; if (!DerivedFrom.IsStatic) { // parameters for a node will be where the Subject at this level is filtered by ID = this node's ID. // Nodes below this one should filter correctly with this parameter if the configuration has been set up correctly. var p2 = new SimpleParameter(DerivedFrom.Subject.IdField, "=", ID); // we also want to combine any custom parameters that this node might have if (p != null) { var c = new Conjunction() .Parameter(p) .Parameter(p2); p = c; } else p = p2; } return p; }