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