public void AuthorizePrivilagedUser() { string userName = "******"; string password = "******"; string expectedOutput = "{\"Status\":\"True\",\"UserType\":\"privilaged\"}"; IAuthService mockAuthService = new Mock <AuthService>(dataRepo, help).Object; IPricingService mockPricingService = new Mock <PricingService>(printEstimate).Object; var JstoreController = new JstoreController(mockAuthService, mockPricingService); string result = JstoreController.AuthenticateUser(userName, password); Assert.AreEqual(expectedOutput, result); }
public void EstimatePriceNoDiscount() { PriceModel model = new PriceModel(); model.price = 4387; model.weight = 26; model.discount = 0; float expectedOutput = 114062; IAuthService mockAuthService = new Mock <AuthService>(dataRepo, help).Object; IPricingService mockPricingService = new Mock <PricingService>(printEstimate).Object; var JstoreController = new JstoreController(mockAuthService, mockPricingService); float result = JstoreController.EstimatePrice(model); Assert.AreEqual(expectedOutput, result); }
public void PrintPriceScreen() { PriceModel model = new PriceModel(); model.price = 4387; model.weight = 26; model.discount = 0; model.finalPrice = 114062; string expectedOutput = "Gold Price: 4387 Rs\r\nWeight: 26 gms\r\nFinal Price: 114062 Rs"; IAuthService mockAuthService = new Mock <AuthService>(dataRepo, help).Object; IPricingService mockPricingService = new Mock <PricingService>(printEstimate).Object; var JstoreController = new JstoreController(mockAuthService, mockPricingService); string result = JstoreController.PrintpriceEstimation(model, PrintType.printOnScreen); Assert.AreEqual(expectedOutput, result); }
public void PrintPricePaper() { PriceModel model = new PriceModel(); model.price = 4387; model.weight = 26; model.discount = 0; model.finalPrice = 114062; string expectedOutput = "The method or operation is not implemented."; IAuthService mockAuthService = new Mock <AuthService>(dataRepo, help).Object; IPricingService mockPricingService = new Mock <PricingService>(printEstimate).Object; var JstoreController = new JstoreController(mockAuthService, mockPricingService); var ex = JstoreController.PrintpriceEstimation(model, PrintType.printToPaper); Assert.AreEqual(ex, expectedOutput); }