public void Sprint_service_Add_method_should_throw_FormatException() { Sprint bk = new Sprint(); var mockRepo = new Mock <ISprintRepository>(); mockRepo.Setup(x => x.Add(bk)).Throws(new FormatException()); SprintService obj = new SprintService(mockRepo.Object); var exception = Record.Exception(() => obj.Add(bk)); Assert.IsType <FormatException>(exception); }
public void Sprint_service_Add_method_should_throw_null_exception_with_empty_input_object() { Sprint bk = new Sprint(); var mockRepo = new Mock <ISprintRepository>(); mockRepo.Setup(x => x.Add(bk)); SprintService obj = new SprintService(mockRepo.Object); var exception = Record.Exception(() => obj.Add(bk)); Assert.Equal(null, exception); }