public void ApoDepartmentServiceShouldReturnNullWhenNameNotMatched() { var service = new ApoSubClassService(_apoClassRepository, _apoSubClassRepository); var resource = new ApoSubClassForCreateOrEdit() { Name = "Miscellaneousssss" }; var sut = service.GetByName(resource); Assert.Null(sut); }
public void ApoDepartmentShouldReturnCorrectValueWhenSearchMatched() { var service = new ApoSubClassService(_apoClassRepository, _apoSubClassRepository); var resource = new ApoSubClassForCreateOrEdit() { Name = "Import Frozen Appetizer" }; var selectedApo = _apoSubClass.Single(x => x.Name.Equals("Import Frozen Appetizer")); var className = _apoClass.Single(x => x.Id == selectedApo.ApoClassId).Name; var sut = service.GetByName(resource); Assert.Equal(sut.Name, "Import Frozen Appetizer"); Assert.Equal(sut.ApoClassId, selectedApo.ApoClassId); Assert.Equal(sut.ApoClassName, className); Assert.Equal(sut.Id, selectedApo.Id); }