public void GetValue_BooleanTests(string strValue, bool?expected) { //Given _cell.Setup(x => x.ToString()).Returns(strValue); //When var value = CellExtensions.GetValue(_cell.Object, new FieldConfig { Type = "boolean" }); //Then value.Should().Be(expected); }
public void GetValue_Numeric_WhenTypeIsNotNumeric_ReturnsValidNumeric(string strValue, double?expected) { //Given _cell.Setup(x => x.ToString()).Returns(strValue); _cell.SetupGet(x => x.CellType).Returns(CellType.String); //When var value = CellExtensions.GetValue(_cell.Object, new FieldConfig { Type = "numeric" }); //Then value.Should().Be(expected); }
public void GetValue_NumericTest(string strValue, double?expected) { //Givend _cell.Setup(x => x.ToString()).Returns(strValue); _cell.SetupGet(x => x.CellType).Returns(CellType.Numeric); _cell.SetupGet(x => x.NumericCellValue).Returns(expected.Value); //When var value = CellExtensions.GetValue(_cell.Object, new FieldConfig { Type = "numeric" }); //Then value.Should().Be(expected); }
public void GetValue_WhenDateFormatIsInvalid_ReturnsInvalidDate() { //Given _cell.Setup(x => x.ToString()).Returns("xxx"); //When var value = CellExtensions.GetValue(_cell.Object, new FieldConfig { Type = "date", Validations = new ValidationOptions { } }); //Then value.Should().BeOfType(typeof(DateResult)); }
public void GetValue_DateTests(string strDate, string[] formats, DateResult expected) { //Given _cell.Setup(x => x.ToString()).Returns(strDate); //When var value = CellExtensions.GetValue(_cell.Object, new FieldConfig { Type = "date", Validations = new ValidationOptions { Formats = formats } }); //Then value.Should().BeEquivalentTo(expected); }