Modularizing Legacy Projects Using TDD by Khaled El-Morabea & Hassaan El-Garem
Author:Khaled El-Morabea & Hassaan El-Garem
Language: eng
Format: epub
ISBN: 9781484274286
Publisher: Apress
If you recall, we used this approach in Chapter 6 when we were writing tests for MainViewModel. MainViewModel depended on NetworkLayer, so we created NetworkLayerStub using inheritance. And it looked like this :class NetworkLayerStub: NetworkLayer {
var stubbedData:Data?
init(stubbedData:Data) {
self.stubbedData = stubbedData
}
public override func executeNetworkRequest(callBack: @escaping (_ data:Data?) -> Void){
let jsonData = self.stubbedData!
callBack(jsonData)
}
}
We inherit from NetworkLayer, and we override executeNetworkRequest and make it return stubbedData instead of actually making a network request. We set stubbedData from our tests as needed.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Exploring Deepfakes by Bryan Lyon and Matt Tora(7765)
Robo-Advisor with Python by Aki Ranin(7660)
Offensive Shellcode from Scratch by Rishalin Pillay(6121)
Microsoft 365 and SharePoint Online Cookbook by Gaurav Mahajan Sudeep Ghatak Nate Chamberlain Scott Brewster(5063)
Ego Is the Enemy by Ryan Holiday(4963)
Management Strategies for the Cloud Revolution: How Cloud Computing Is Transforming Business and Why You Can't Afford to Be Left Behind by Charles Babcock(4440)
Python for ArcGIS Pro by Silas Toms Bill Parker(4199)
Elevating React Web Development with Gatsby by Samuel Larsen-Disney(3905)
Machine Learning at Scale with H2O by Gregory Keys | David Whiting(3646)
Learning C# by Developing Games with Unity 2021 by Harrison Ferrone(3286)
Speed Up Your Python with Rust by Maxwell Flitton(3235)
Liar's Poker by Michael Lewis(3228)
OPNsense Beginner to Professional by Julio Cesar Bueno de Camargo(3195)
Extreme DAX by Michiel Rozema & Henk Vlootman(3176)
Agile Security Operations by Hinne Hettema(3125)
Linux Command Line and Shell Scripting Techniques by Vedran Dakic and Jasmin Redzepagic(3112)
Essential Cryptography for JavaScript Developers by Alessandro Segala(3083)
Cryptography Algorithms by Massimo Bertaccini(3002)
AI-Powered Commerce by Andy Pandharikar & Frederik Bussler(2985)
