public void TestCustomer(string fname, string lname, string username, string password) { // ARRANGE - create the data to insert into the Db //create the new Person seed AuthModel authModel = new AuthModel() { FirstName = fname, LastName = lname, Username = username, Password = password }; Customer outCustomer = null; bool success = false; using (var context1 = new DbContextClass(testOptions)) { context1.Database.EnsureDeleted(); //do this ONCE at hte beginning of each test context1.Database.EnsureCreated(); // this creates the new-for-this-test database //create the MemeSaverRepo instance ToyRepository msr = new ToyRepository(context1); success = msr.RegisterTest(authModel, out outCustomer); } Assert.True(success); Assert.Equal(outCustomer.FirstName, authModel.FirstName); Assert.Equal(outCustomer.LastName, authModel.LastName); Assert.Equal(outCustomer.CustomerUName, authModel.Username); // ACT - call the method that inserts into the Db Customer outCustomer2 = new Customer(); using (var context2 = new DbContextClass(testOptions)) { context2.Database.EnsureCreated(); ToyRepository msr = new ToyRepository(context2); success = msr.LoginTest(authModel, out outCustomer2); // success = context2.Persons.Where(x => x.PasswordHash == testPerson.PasswordHash).FirstOrDefault(); } // ASSERT - verify the the data state is as expected Assert.Equal(outCustomer2.FirstName, authModel.FirstName); Assert.Equal(outCustomer2.LastName, authModel.LastName); Assert.Equal(outCustomer2.CustomerUName, authModel.Username); Assert.True(success); }
public SellableLogic(ToyRepository toyRepository) { this._toyRepository = toyRepository; }
public OrderLogic(ToyRepository _toyRepository, Authenticator _authenticator) { this._toyRepository = _toyRepository; this._authenticator = _authenticator; }