public void ToWorkClassUpdateModelMethodDoesNotThrowExceptionIfFirstParameterIsNull() { ToWork testObject = new ToWork { AtTime = _rnd.NextTimeOfDay(), Text = _rnd.NextString(_rnd.Next(64)) }; testObject.UpdateModel(null, null); }
public void ToWorkClassUpdateModelMethodSetsDisplayedTextPropertyOfTargetToEmptyStringIfAtTimePropertyIsNullAndTextPropertyIsNull() { ToWork testObject = new ToWork { AtTime = null, Text = null }; GenericTimeModel testTarget = new GenericTimeModel { ActualTime = _rnd.NextTimeOfDay(), DisplayedText = _rnd.NextString(_rnd.Next(64)) }; testObject.UpdateModel(testTarget, null); Assert.AreEqual("", testTarget.DisplayedText); }
public void ToWorkClassUpdateModelMethodSetsDisplayedTextPropertyOfTargetCorrectlyIfTextPropertyIsNullAndSecondParameterIsNull() { ToWork testObject = new ToWork { AtTime = _rnd.NextTimeOfDay(), Text = null }; GenericTimeModel testTarget = new GenericTimeModel { ActualTime = _rnd.NextTimeOfDay(), DisplayedText = _rnd.NextString(_rnd.Next(64)) }; testObject.UpdateModel(testTarget, null); Assert.AreEqual(testObject.AtTime.ToString(), testTarget.DisplayedText); }
public void ToWorkClassUpdateModelMethodSetsActualTimePropertyOfTargetIfTextPropertyIsEmptyString() { ToWork testObject = new ToWork { AtTime = _rnd.NextTimeOfDay(), Text = "" }; GenericTimeModel testTarget = new GenericTimeModel { ActualTime = _rnd.NextTimeOfDay(), DisplayedText = _rnd.NextString(_rnd.Next(64)) }; testObject.UpdateModel(testTarget, null); Assert.AreEqual(testObject.AtTime, testTarget.ActualTime); }
public void ToWorkClassUpdateModelMethodSetsDisplayedTextPropertyOfTargetCorrectlyIfTextPropertyIsNullAndSecondParameterIsNotNull() { ToWork testObject = new ToWork { AtTime = _rnd.NextTimeOfDay(), Text = null }; GenericTimeModel testTarget = new GenericTimeModel { ActualTime = _rnd.NextTimeOfDay(), DisplayedText = _rnd.NextString(_rnd.Next(64)) }; testObject.UpdateModel(testTarget, new TimeDisplayFormattingStrings { TimeWithoutFootnotes = "mmHH" }); Assert.AreEqual(testObject.AtTime.ToString("mmHH", CultureInfo.CurrentCulture), testTarget.DisplayedText); }