public void SimpleParameter_Restore() { // Arrange var mockPath = MockRepository.GenerateMock<FieldPath>(); var mockPathDTO = MockRepository.GenerateMock<FieldPathDTO>(); var mockPathAssembler = MockRepository.GenerateMock<FieldPathAssembler>((IConfiguration)null); mockPathAssembler.Stub(x => x.Restore(mockPathDTO)).Return(mockPath); var assemblerUnderTest = new SimpleParameterAssembler(mockPathAssembler); var dto = new SimpleParameterDTO() { Path = mockPathDTO, Operator = "=", Value = 1 }; // Act var restored = assemblerUnderTest.Restore(dto); // Assert Assert.IsNotNull(restored); Assert.IsInstanceOf<SimpleParameter>(restored); var p = (SimpleParameter)restored; Assert.AreSame(mockPath, p.Path); Assert.AreEqual(dto.Operator, p.Operator); Assert.AreEqual(dto.Value, p.Value); mockPathAssembler.VerifyAllExpectations(); }
public void SimpleParameter_Restore() { // Arrange var mockPath = MockRepository.GenerateMock <FieldPath>(); var mockPathDTO = MockRepository.GenerateMock <FieldPathDTO>(); var mockPathAssembler = MockRepository.GenerateMock <FieldPathAssembler>((IConfiguration)null); mockPathAssembler.Stub(x => x.Restore(mockPathDTO)).Return(mockPath); var assemblerUnderTest = new SimpleParameterAssembler(mockPathAssembler); var dto = new SimpleParameterDTO() { Path = mockPathDTO, Operator = "=", Value = 1 }; // Act var restored = assemblerUnderTest.Restore(dto); // Assert Assert.IsNotNull(restored); Assert.IsInstanceOf <SimpleParameter>(restored); var p = (SimpleParameter)restored; Assert.AreSame(mockPath, p.Path); Assert.AreEqual(dto.Operator, p.Operator); Assert.AreEqual(dto.Value, p.Value); mockPathAssembler.VerifyAllExpectations(); }
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_Restore() { // Arrange var mockPathAssembler = new FieldPathAssemblerStub(); var assemblerUnderTest = new SimpleParameterAssembler(mockPathAssembler); var dto = new SimpleParameterDTO() { Path = FieldPathAssemblerStub.DTO, Operator = "=", Value = 1 }; // Act var restored = assemblerUnderTest.Restore(dto); // Assert Assert.IsNotNull(restored); Assert.IsInstanceOf <SimpleParameter>(restored); var p = (SimpleParameter)restored; Assert.AreSame(FieldPathAssemblerStub.Source, p.Path); Assert.AreEqual(dto.Operator, p.Operator); Assert.AreEqual(dto.Value, p.Value); }