public void Convert_WhenPassedTypeIsNotBool_ReturnsNull(Type passedType) { //Given var propertyInfoMock = new Mock <PropertyInfo>(); propertyInfoMock.SetupGet(p => p.PropertyType).Returns(passedType); //When var cell = new BoolToGridCellConverter().Convert(propertyInfoMock.Object); //Then cell.ShouldBeNull(); }
public void Convert_WhenPassedBool_ReturnsCheckBoxCellWithCorrectBinding() { //Given var model = new Mock <ITestModel>(); model.SetupGet(m => m.Bool).Returns(false); var property = model.Object.GetType().GetProperty(nameof(ITestModel.Bool)); //When var cell = new BoolToGridCellConverter().Convert(property); //Then cell.ShouldBeOfType <CheckBoxCell>(); cell.As <CheckBoxCell>().Binding.GetValue(model.Object).ShouldBe(false); model.SetupGet(m => m.Bool).Returns(true); cell.As <CheckBoxCell>().Binding.GetValue(model.Object).ShouldBe(true); }