public void TestThatIfTheMethodIsNotCallableICreatesTheNotOkResponse() { HeyResponseFactory factory = new HeyResponseFactory(new MethodNotFound(new HeyRememberDto())); IHeyResponse response = factory.Make(BackgroundScheduleType.MakePrototype()); Assert.IsInstanceOf <MethodNotFoundHeyResponse>(response); }
public void TestThatIfTheMethodHasErrorOnParameterItReturnsNotOkResponse() { MethodInfo method = typeof(FactoryBindingTest).GetMethod(nameof(FactoryBindingTest.WithParametersBindableMethod)); MethodBinder binder = new MethodBinder(method, new HeyRememberDto()); HeyResponseFactory factory = new HeyResponseFactory(binder); IHeyResponse response = factory.Make(BackgroundScheduleType.MakePrototype()); Assert.IsInstanceOf <ParametersErrorHeyResponse>(response); }
public void TestThatIfTheMethodIsCallableICreatesTheOkResponse() { MethodInfo method = typeof(FactoryBindingTest).GetMethod(nameof(FactoryBindingTest.EmptyBindableMethod)); MethodBinder binder = new MethodBinder(method, new HeyRememberDto()); HeyResponseFactory factory = new HeyResponseFactory(binder); IHeyResponse response = factory.Make(BackgroundScheduleType.MakePrototype(), new CreatedHttpReturn()); Assert.IsInstanceOf <OkHeyResponse>(response); }
public void TestThatIfTheMethodHasErrorOnParameterTypeItReturnsNotOkResponseWithTheNumberOfTheParameterThatGotError() { MethodInfo method = typeof(FactoryBindingTest).GetMethod(nameof(FactoryBindingTest.WithParametersBindableMethod)); MethodBinder binder = new MethodBinder(method, new HeyRememberDto() { DomainSpecificData = "[1, \"banana\"]" }); HeyResponseFactory factory = new HeyResponseFactory(binder); IHeyResponse response = factory.Make(BackgroundScheduleType.MakePrototype()); Assert.IsInstanceOf <ParametersErrorHeyResponse>(response); Assert.AreEqual(1, ((ParametersErrorHeyResponse)response).ParamNum); }