Pibbles
Pibbles
Explore posts from servers
CC#
Created by Pibbles on 9/15/2023 in #help
Unit Testing Classes with Dependency Injection (ASP.NET Core)
well thanks again, talking it through really helped a lot
66 replies
CC#
Created by Pibbles on 9/15/2023 in #help
Unit Testing Classes with Dependency Injection (ASP.NET Core)
if I have a unit test for this method I just want it testing this method
66 replies
CC#
Created by Pibbles on 9/15/2023 in #help
Unit Testing Classes with Dependency Injection (ASP.NET Core)
honestly man I'm going to mock it you totally convinced me when you pointed out that just using the service means I'd be testing the mapper method when testing this method
66 replies
CC#
Created by Pibbles on 9/15/2023 in #help
Unit Testing Classes with Dependency Injection (ASP.NET Core)
I made my own static mapper so yeah
66 replies
CC#
Created by Pibbles on 9/15/2023 in #help
Unit Testing Classes with Dependency Injection (ASP.NET Core)
hm, okay for now I think I'll mock the mapper, in reality I won't end up changing stuff a huge amount for it to be a pain, and I really don't like the idea of not mocking it, and then this unit test testing other units...you've convinced me
66 replies
CC#
Created by Pibbles on 9/15/2023 in #help
Unit Testing Classes with Dependency Injection (ASP.NET Core)
yeah mine is that without the mapping lmao
66 replies
CC#
Created by Pibbles on 9/15/2023 in #help
Unit Testing Classes with Dependency Injection (ASP.NET Core)
would you not test your controller method though?
66 replies
CC#
Created by Pibbles on 9/15/2023 in #help
Unit Testing Classes with Dependency Injection (ASP.NET Core)
I have the API, which is made up of the controller method -> service layer (handles business logic and calls mapper service) -> data access layer (contains no business logic)
66 replies
CC#
Created by Pibbles on 9/15/2023 in #help
Unit Testing Classes with Dependency Injection (ASP.NET Core)
oh I'm probably just naming stuff wrong tbh
66 replies
CC#
Created by Pibbles on 9/15/2023 in #help
Unit Testing Classes with Dependency Injection (ASP.NET Core)
it would make it more of a unit test you are right there, since rn it would effectively be testing the mapper
66 replies
CC#
Created by Pibbles on 9/15/2023 in #help
Unit Testing Classes with Dependency Injection (ASP.NET Core)
maybe I should just mock it anyway
66 replies
CC#
Created by Pibbles on 9/15/2023 in #help
Unit Testing Classes with Dependency Injection (ASP.NET Core)
hm
66 replies
CC#
Created by Pibbles on 9/15/2023 in #help
Unit Testing Classes with Dependency Injection (ASP.NET Core)
it's just that mocking the mapper is probably going to cause more pain down the line if I change the mapper or the object coming out
66 replies
CC#
Created by Pibbles on 9/15/2023 in #help
Unit Testing Classes with Dependency Injection (ASP.NET Core)
it's using a mapper
66 replies
CC#
Created by Pibbles on 9/15/2023 in #help
Unit Testing Classes with Dependency Injection (ASP.NET Core)
it's basically using a helper method
66 replies
CC#
Created by Pibbles on 9/15/2023 in #help
Unit Testing Classes with Dependency Injection (ASP.NET Core)
it's not using a huge portion at all
66 replies
CC#
Created by Pibbles on 9/15/2023 in #help
Unit Testing Classes with Dependency Injection (ASP.NET Core)
I mean I would mock them if it weren't such a pain to do so but I'd say that if it's still internal to the project, and not using the more external stuff like a database, I'd still think of it as a unit test
66 replies
CC#
Created by Pibbles on 9/15/2023 in #help
Unit Testing Classes with Dependency Injection (ASP.NET Core)
I mean, these should just be unit tests
66 replies
CC#
Created by Pibbles on 9/15/2023 in #help
Unit Testing Classes with Dependency Injection (ASP.NET Core)
Yeah I was just checking there wasn’t some simpler way people used but it seems like this is still the best
66 replies
CC#
Created by Pibbles on 9/15/2023 in #help
Unit Testing Classes with Dependency Injection (ASP.NET Core)
And one of the interfaces is a mapper, so any change to the object I’m mapping and I’ll have to change them all etc
66 replies