public void Scalar_WithValue() { Expect.Call(_mockProperty.IsList).Return(false); Expect.Call(_mockBusinessObject.GetProperty(_mockProperty)).Return("ExpectedStringValue"); _mockRepository.ReplayAll(); string actual = _stringFormatterService.GetPropertyString(_mockBusinessObject, _mockProperty, null); _mockRepository.VerifyAll(); Assert.That(actual, Is.EqualTo("ExpectedStringValue")); }
public void Scalar_WithBusinessObjectValue() { var valueStub = MockRepository.GenerateStub <IBusinessObject>(); // Cannot stub ToString() // valueStub.Stub (_=>_.ToString()).Return ("ExpectedStringValue"); _businessObjectStub.Stub(_ => _.GetProperty(_propertyStub)).Return(valueStub); string actual = _stringFormatterService.GetPropertyString(_businessObjectStub, _propertyStub, null); Assert.That(actual, Is.EqualTo(valueStub.ToString())); }
public void Scalar_WithValue() { IEnumerationValueInfo enumValueInfo = new EnumerationValueInfo(TestEnum.Value5, "Value5", "ExpectedStringValue", true); Expect.Call(_mockProperty.IsList).Return(false); Expect.Call(_mockBusinessObject.GetProperty(_mockProperty)).Return(TestEnum.Value5); Expect.Call(_mockProperty.GetValueInfoByValue(TestEnum.Value5, _mockBusinessObject)).Return(enumValueInfo); _mockRepository.ReplayAll(); string actual = _stringFormatterService.GetPropertyString(_mockBusinessObject, _mockProperty, null); _mockRepository.VerifyAll(); Assert.That(actual, Is.EqualTo("ExpectedStringValue")); }
public void Scalar_WithValu_AndDateTimeProperty() { Expect.Call(_mockProperty.Type).Return(DateTimeType.DateTime); Expect.Call(_mockProperty.IsList).Return(false); Expect.Call(_mockBusinessObject.GetProperty(_mockProperty)).Return(new DateTime(2000, 4, 14, 3, 45, 10)); _mockRepository.ReplayAll(); using (new CultureScope(new CultureInfo("de-de"), new CultureInfo("de-de"))) { string actual = _stringFormatterService.GetPropertyString(_mockBusinessObject, _mockProperty, null); _mockRepository.VerifyAll(); Assert.That(actual, Is.EqualTo("14.04.2000 03:45")); } }
public void List_WithoutLineCount() { Expect.Call(_mockProperty.IsList).Return(true); Expect.Call(_mockBusinessObject.GetProperty(_mockProperty)).Return(_mockValues); Expect.Call(_mockValues[0].ToString(null, null)).Return("First"); _mockRepository.ReplayAll(); string actual = _stringFormatterService.GetPropertyString(_mockBusinessObject, _mockProperty, null); _mockRepository.VerifyAll(); Assert.That(actual, Is.EqualTo("First ... [3]")); }