public void String_Is_Mapped_To_Enum() { var employee = new EmployeeWithStringEnum { Id = Guid.NewGuid(), Name = "Timuçin", Department = Departments.IT.ToString() }; var dto = TypeAdapter.Adapt<EmployeeWithStringEnum, EmployeeDTO>(employee); dto.ShouldNotBeNull(); dto.Id.ShouldEqual(employee.Id); dto.Name.ShouldEqual(employee.Name); dto.Department.ShouldEqual(Departments.IT); }
public void String_Is_Mapped_To_Enum() { var employee = new EmployeeWithStringEnum { Id = Guid.NewGuid(), Name = "Timuçin", Department = Departments.IT.ToString() }; var dto = TypeAdapter.Adapt <EmployeeWithStringEnum, EmployeeDTO>(employee); dto.ShouldNotBeNull(); dto.Id.ShouldBe(employee.Id); dto.Name.ShouldBe(employee.Name); dto.Department.ShouldBe(Departments.IT); }
public void Null_String_Is_Mapped_To_Enum_Default() { TypeAdapterConfig<EmployeeWithStringEnum, EmployeeDTO> .NewConfig(); var employee = new EmployeeWithStringEnum { Id = Guid.NewGuid(), Name = "Timuçin", Department = null }; var dto = TypeAdapter.Adapt<EmployeeWithStringEnum, EmployeeDTO>(employee); dto.ShouldNotBeNull(); dto.Id.ShouldEqual(employee.Id); dto.Name.ShouldEqual(employee.Name); dto.Department.ShouldEqual(Departments.Finance); }
public void Empty_String_Is_Mapped_To_Enum_Default() { TypeAdapterConfig <EmployeeWithStringEnum, EmployeeDTO> .NewConfig(); var employee = new EmployeeWithStringEnum { Id = Guid.NewGuid(), Name = "Timuçin", Department = "" }; var dto = TypeAdapter.Adapt <EmployeeWithStringEnum, EmployeeDTO>(employee); dto.ShouldNotBeNull(); dto.Id.ShouldBe(employee.Id); dto.Name.ShouldBe(employee.Name); dto.Department.ShouldBe(Departments.Finance); }