public void SelectTemplate_WhenTemplatesNotInitialized_ThrowsException() { //Arrange var mock = Mock.Create<IMessageHistoryItem>(Behavior.CallOriginal); Mock.Arrange(() => mock.IsMe).Returns(true); //Act var messageHistoryDataTemplateSelector = new MessageHistoryTemplateSelector(); messageHistoryDataTemplateSelector.SelectTemplate(mock, null); }
public void SelectTemplate_WhenIsMe_ReturnsMeTemplate() { //Arrange var mock = Mock.Create<IMessageHistoryItem>(Behavior.CallOriginal); Mock.Arrange(() => mock.IsMe).Returns(true); //Act var messageHistoryDataTemplateSelector = new MessageHistoryTemplateSelector(); var meTemplate = new DataTemplate(); var otherTemplate = new DataTemplate(); messageHistoryDataTemplateSelector.MeTempalte = meTemplate; messageHistoryDataTemplateSelector.OtherTemplate = otherTemplate; var result = messageHistoryDataTemplateSelector.SelectTemplate(mock, null); //Assert Assert.AreEqual(result, meTemplate); Assert.AreNotEqual(result, otherTemplate); }