public void Retrieve_correct_nullable_value(string value, byte?expectation) { var retriever = new ByteValueRetriever(); var result = (byte?)retriever.Retrieve(new KeyValuePair <string, string>(IrrelevantKey, value), IrrelevantType, typeof(byte?)); result.Should().Be(expectation); }
public void CanRetrieve(Type type, bool expectation) { var retriever = new ByteValueRetriever(); var result = retriever.CanRetrieve(new KeyValuePair <string, string>(IrrelevantKey, IrrelevantKey), IrrelevantType, type); result.Should().Be(expectation); }
public void Returns_a_byte_when_passed_a_byte_value() { var retriever = new ByteValueRetriever(); retriever.GetValue("1").ShouldEqual <byte>(1); retriever.GetValue("3").ShouldEqual <byte>(3); retriever.GetValue("30").ShouldEqual <byte>(30); }
public void Returns_a_byte_when_passed_a_byte_value_if_culture_is_fr_Fr() { Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR", false); var retriever = new ByteValueRetriever(); retriever.GetValue("30,0").Should().Be(30); }
public void Retrieve_a_byte_when_passed_a_byte_value_if_culture_is_fr_Fr() { Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR", false); var retriever = new ByteValueRetriever(); var result = (byte?)retriever.Retrieve(new KeyValuePair <string, string>(IrrelevantKey, "30,0"), IrrelevantType, typeof(byte?)); result.Should().Be(30); }
public void Returns_a_zero_when_passed_an_invalid_byte() { var retriever = new ByteValueRetriever(); retriever.GetValue("x").ShouldEqual <byte>(0); retriever.GetValue("").ShouldEqual <byte>(0); retriever.GetValue("-1").ShouldEqual <byte>(0); retriever.GetValue("500").ShouldEqual <byte>(0); retriever.GetValue("every good boy does fine").ShouldEqual <byte>(0); }