tejak123 Posted January 22, 2016 Report Posted January 22, 2016 C# code rasanu .. Maa tl antadu.. "It works but cannot be unit tested using Moq Framework. So please write a code that is testable by moq framework .. " Naku poorthi ga ardham kaaledhu .. But he I heard some words like "decouple the code and inject the dependency " ani annadu ... Please help bhaiyyas
andhravodu Posted January 22, 2016 Report Posted January 22, 2016 Malli first nunchi rayi ani Dani ardam Rofl
tejak123 Posted January 22, 2016 Author Report Posted January 22, 2016 Malli first nunchi rayi ani Dani ardam Implementation code and Logic code already undhi.. kaani.. i dont know what he want in terms of decoupling and inject dependency using interface
rikki Posted January 22, 2016 Report Posted January 22, 2016 obv. nuvu classes ni direct ga instantiate chesi use chestunnav..so there is a tight dependency there..interface use chesi make your code aware of interface method and not the actual method ani dani ardam C# code rasanu .. Maa tl antadu.. "It works but cannot be unit tested using Moq Framework. So please write a code that is testable by moq framework .. " Naku poorthi ga ardham kaaledhu .. But he I heard some words like "decouple the code and inject the dependency " ani annadu ... Please help bhaiyyas
tejak123 Posted January 22, 2016 Author Report Posted January 22, 2016 obv. nuvu classes ni direct ga instantiate chesi use chestunnav..so there is a tight dependency there..interface use chesi make your code aware of interface method and not the actual method ani dani ardam Exactly.. adhey annadu... I am not very good at coding in this level My code .. Class A ,Class B, Class C unnayi ClassA ca= new ClassA(); ca.Copy(); ClassB cb= new ClassB(); cb.Copy(); ClassC cc= new Classc(); cc.Copy(); copy method ni read and write ga rendu methods ga marchukommannadu.. sqlconnection undhi method lo , nv dependency pettesav sqlconnection ki ani.. I see what he is trying to convey but naku idea ravatledhu
puli_keka Posted January 22, 2016 Report Posted January 22, 2016 naaku full knowledge ledhu.yet.. but you have to use Ninject/MEF/autofac to get the object of the class and only interface vadali in the actual code..look at examples(there are bunch) and take help of another dev
Srimantudu Posted January 22, 2016 Report Posted January 22, 2016 naaku full knowledge ledhu.yet.. but you have to use Ninject/MEF/autofac to get the object of the class and only interface vadali in the actual code..look at examples(there are bunch) and take help of another dev
puli_keka Posted January 22, 2016 Report Posted January 22, 2016 naaku full knowledge ledhu.yet.. but you have to use Ninject/MEF/autofac to get the object of the class and only interface vadali in the actual code..look at examples(there are bunch) and take help of another dev pilladiki help cheyochuga u nasty vuncle
chandra916 Posted January 22, 2016 Report Posted January 22, 2016 naaku full knowledge ledhu.yet.. but you have to use Ninject/MEF/autofac to get the object of the class and only interface vadali in the actual code..look at examples(there are bunch) and take help of another dev suruku
ramudu3 Posted January 22, 2016 Report Posted January 22, 2016 thesi 10gu annadu .... .NET DOI frameworks ento naaku thelisi so no furthur comments bahyaaaa Exactly.. adhey annadu... I am not very good at coding in this level My code .. Class A ,Class B, Class C unnayi ClassA ca= new ClassA(); ca.Copy(); ClassB cb= new ClassB(); cb.Copy(); ClassC cc= new Classc(); cc.Copy(); copy method ni read and write ga rendu methods ga marchukommannadu.. sqlconnection undhi method lo , nv dependency pettesav sqlconnection ki ani.. I see what he is trying to convey but naku idea ravatledhu
rikki Posted January 22, 2016 Report Posted January 22, 2016 just outline and naku telisindi rasa..hope this helps i dont have a strong command on this so get a second opinion public interface IJambalHeart { void Read(string conn); void Write(string conn); } public class ClassA: IJambalHeart { public void Read(string conn) { //ne istam } public void Write(string conn) { //ne istam } } alage classB, class ClassA public class SomeClass { private readonly IJambalHeart jambal; public SomeClass(IJambalHeart jambal) { this.jambal = jambal; } //read method calling public void ReadMethod(string conn) { //here jambal is class jambal.Read(conn); } public void WriteMethod(string conn) { //here jambal is class jambal.Write(conn); } } from where you are calling just inst interface IJambalHeart jambal = new ClassA(); //classc whatever you want SomeClass cl = new SomeClass(jambal); cl.ReadMethod(connection parameter); c1.WriteMethod(connection para); Exactly.. adhey annadu... I am not very good at coding in this level My code .. Class A ,Class B, Class C unnayi ClassA ca= new ClassA(); ca.Copy(); ClassB cb= new ClassB(); cb.Copy(); ClassC cc= new Classc(); cc.Copy(); copy method ni read and write ga rendu methods ga marchukommannadu.. sqlconnection undhi method lo , nv dependency pettesav sqlconnection ki ani.. I see what he is trying to convey but naku idea ravatledhu
Recommended Posts