private static async Task AddRetailer() { try { Retailer newRetailer = new Retailer(); Console.WriteLine("Enter Retailer Name :"); newRetailer.RetailerName = Console.ReadLine(); Console.WriteLine("Enter Phone Number :"); newRetailer.RetailerMobile = Console.ReadLine(); Console.WriteLine("Enter Retailer's Email"); newRetailer.Email = Console.ReadLine(); Console.WriteLine("Enter Retailer's Password"); newRetailer.Password = Console.ReadLine(); newRetailer.RetailerID = default(Guid); RetailerBL rb = new RetailerBL(); bool retailerAdded = await rb.AddRetailerBL(newRetailer); if (retailerAdded) { Console.WriteLine("Retailer Added"); Console.WriteLine("Your User id is " + newRetailer.Email); } else { Console.WriteLine("Retailer Not Added"); } } catch (GreatOutdoorException ex) { Console.WriteLine(ex.Message); } }
public async Task RetailerEmailRegExp() { //Arrange RetailerBL retailerBL = new RetailerBL(); Retailer retailer = new Retailer() { RetailerName = "John", RetailerMobile = "9877897890", Password = "******", Email = "john" }; bool isAdded = false; string errorMessage = null; //Act try { isAdded = await retailerBL.AddRetailerBL(retailer); } catch (Exception ex) { isAdded = false; errorMessage = ex.Message; } finally { //Assert Assert.IsFalse(isAdded, errorMessage); } }
public async Task RetailerMobileCanNotBeNull() { //Arrange RetailerBL retailerBL = new RetailerBL(); Retailer retailer = new Retailer() { RetailerName = "Smith", RetailerMobile = null, Password = "******", Email = "*****@*****.**" }; bool isAdded = false; string errorMessage = null; //Act try { isAdded = await retailerBL.AddRetailerBL(retailer); } catch (Exception ex) { isAdded = false; errorMessage = ex.Message; } finally { //Assert Assert.IsFalse(isAdded, errorMessage); } }
public async Task AddValidRetailer() { //Arrange RetailerBL retailerBL = new RetailerBL(); Retailer retailer = new Retailer() { RetailerName = "Scott", RetailerMobile = "9876543210", Password = "******", Email = "*****@*****.**" }; bool isAdded = false; string errorMessage = null; //Act try { isAdded = await retailerBL.AddRetailerBL(retailer); } catch (Exception ex) { isAdded = false; errorMessage = ex.Message; } finally { //Assert Assert.IsTrue(isAdded, errorMessage); } }