public void CanConvert() { // arrange var converter = new BoolConverter(); // act var result1 = converter.CanConvert(false.GetType()); var result2 = converter.CanConvert(typeof(bool?)); var result3 = converter.CanConvert("".GetType()); // assert Assert.True(result1); Assert.True(result2); Assert.False(result3); }
public void CanConvert_Should_RecognizeBooleanType(Type testType, bool expectedResult) { var boolConverter = new BoolConverter(); var result = boolConverter.CanConvert(testType); result.ShouldEqual(expectedResult); }
public void Should_be_able_to_convert() { var registry = new LocalizationRegistry(new Cache()); registry.RegisterTranslation("en", LocalizationResources.FilterCommands.Achievements, "en-ach"); registry.RegisterTranslation("fr", LocalizationResources.FilterCommands.Achievements, "fr-ach"); registry.RegisterTranslation("en", LocalizationResources.FilterCommands.Selected, "en-sel"); registry.RegisterTranslation("fr", LocalizationResources.FilterCommands.Selected, "fr-sel"); registry.RegisterTranslation("en", LocalizationResources.FilterCommands.Yes, "yes"); registry.RegisterTranslation("fr", LocalizationResources.FilterCommands.Yes, "fr-yes"); registry.RegisterTranslation("en", LocalizationResources.FilterCommands.True, "true"); registry.RegisterTranslation("fr", LocalizationResources.FilterCommands.True, "fr-true"); registry.RegisterTranslation("en", LocalizationResources.FilterCommands.No, "no"); registry.RegisterTranslation("fr", LocalizationResources.FilterCommands.No, "fr-no"); registry.RegisterTranslation("en", LocalizationResources.FilterCommands.False, "false"); registry.RegisterTranslation("fr", LocalizationResources.FilterCommands.False, "fr-false"); var converter = new BoolConverter(registry); converter.CanConvert("en", "en-ach").Result.Should().BeTrue(); converter.CanConvert("en", "en-ach").MappedStaticField.Should().Be(Fields.Achievements); converter.CanConvert("en", "fr-ach").Result.Should().BeTrue(); }