public void Constructing_an_instance_should_initialize_the_command() { String aMessage = "Hello world"; ICommand theCommand = MockRepository.GenerateMock <ICommand>(); var target = new MappingNotFoundException(aMessage, theCommand); target.Command.Should().Be(theCommand); }
public Mapping GetMapping(string worksheetName, string colName) { Dictionary <string, Mapping> mappingDict = GetExtColNameToMappingDict(worksheetName); if (!mappingDict.TryGetValue(colName, out Mapping mapping)) { MappingNotFoundException.SetMessageItems(worksheetName, colName); } return(mapping); }
public void entityType_should_be_included_when_serializing_with_DataContract() { var serializer = new DataContractSerializer(typeof(MappingNotFoundException)); var ms = new MemoryStream(); var sut = new MappingNotFoundException(typeof(string)); serializer.WriteObject(ms, sut); ms.Position = 0; var actual = (MappingNotFoundException)serializer.ReadObject(ms); actual.EntityTypeName.Should().Be(typeof(string).FullName); }
public void message_should_be_included_when_serializing_with_DataContract() { var serializer = new DataContractSerializer(typeof(MappingNotFoundException)); var ms = new MemoryStream(); var sut = new MappingNotFoundException(typeof(string)); serializer.WriteObject(ms, sut); ms.Position = 0; var actual = (MappingNotFoundException)serializer.ReadObject(ms); actual.Message.Should().Be("Failed to find mapper for entity 'System.String'."); }
public void serialization_works_with_datacontract() { var serializer = new DataContractSerializer(typeof(MappingNotFoundException)); var ms = new MemoryStream(); var sut = new MappingNotFoundException(typeof(string)); serializer.WriteObject(ms, sut); ms.Position = 0; var actual = (MappingNotFoundException)serializer.ReadObject(ms); actual.Message.Should().Be("Failed to find mapper for entity 'System.String'."); actual.EntityTypeName.Should().Be(typeof(string).FullName); }
public void serialization_works_with_BinaryFormatter() { var serializer = new BinaryFormatter(); var ms = new MemoryStream(); var sut = new MappingNotFoundException(typeof(string)); serializer.Serialize(ms, sut); ms.Position = 0; var actual = (MappingNotFoundException)serializer.Deserialize(ms); actual.Message.Should().Be("Failed to find mapper for entity 'System.String'."); actual.EntityTypeName.Should().Be(typeof(string).FullName); }
public void It_should_be_serializable() { var aMessage = "Hello world"; ICommand aCommand = MockRepository.GenerateMock <ICommand>(); var theException = new MappingNotFoundException(aMessage, aCommand); MappingNotFoundException deserializedException = null; using (var buffer = new MemoryStream()) { var formatter = new BinaryFormatter(); formatter.Serialize(buffer, theException); buffer.Seek(0, SeekOrigin.Begin); deserializedException = (MappingNotFoundException)formatter.Deserialize(buffer); } deserializedException.Should().NotBeNull(); }
public void type_is_assigned_to_the_property() { var sut = new MappingNotFoundException(typeof(string)); sut.EntityTypeName.Should().Be(typeof(string).FullName); }
public void description_is_assigned_to_base() { var sut = new MappingNotFoundException(typeof(string)); sut.Message.Should().Be("Failed to find mapper for entity 'System.String'."); }