Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public bool Save(T entity)
- {
- entity = new T();
- AllItem.Add(entity);
- return true;
- }
- List<AccountModel> Accounts = new List<AccountModel>();
- private BaseServices<AccountModel> AccountBS = new BaseServices<AccountModel>();
- Random rnd = new Random();
- private int SomeId;
- private int AccountsLenth;
- [TestInitialize]
- public void Repletion()
- {
- SomeId = rnd.Next(100);
- for (int index = 0; index < 100; ++index)
- {
- AccountBS.AllItem.Add(new AccountModel { Id = index });
- }
- AccountsLenth = Accounts.Count;
- }
- [TestMethod]
- public void GetTest()
- {
- AccountModel result = AccountBS.Get(SomeId);
- Assert.IsNotNull(result);
- }
- [TestMethod]
- public void DeleteBoolTest()
- {
- bool result = AccountBS.Delete(SomeId);
- Assert.IsTrue(result);
- }
- [TestMethod]
- public void SaveBoolTest()
- {
- var ent = new AccountModel();
- bool result = AccountBS.Save(ent);
- Assert.IsTrue(result);
- }
- [TestMethod]
- public void SaveCountTest()
- {
- var ent = new AccountModel();
- AccountBS.Save(ent);
- int AccountsLenth1 = Accounts.Count;
- Assert.AreNotEqual(AccountsLenth, this.Accounts.Count);
- }
- }
Add Comment
Please, Sign In to add comment