Пример #1
0
        public void GetAllTest()
        {
            DBSalesPerson dB  = new DBSalesPerson(this.dBConnect);
            var           ppl = dB.GetAll();

            Assert.IsNotNull(ppl, "Null object returned");
            Assert.IsTrue(ppl.Count() > 0, "There are no salesmen");
        }
Пример #2
0
        public void UpdateIllegalNegativeTest()
        {
            DBSalesPerson dB = new DBSalesPerson(this.dBConnect);
            var           sp = new SalesPerson()
            {
                ID = -4
            };

            dB.Update(sp);
        }
Пример #3
0
        public void AddIllegalTest()
        {
            DBSalesPerson dB = new DBSalesPerson(this.dBConnect);

            dB.Create(new SalesPerson()
            {
                Name    = null,
                Surname = "Smith"
            });
        }
Пример #4
0
        public void UpdateGetEntityTest()
        {
            DBSalesPerson dB = new DBSalesPerson(this.dBConnect);

            var sp = dB.Get(1);

            Assert.IsNotNull(sp, "Salesperson not retieved");

            var oldName = sp.Name;

            sp.Name = "Testttt";
            dB.Update(sp);
            Assert.IsTrue(dB.Get(sp.ID).Name != oldName, "Name not changed");

            sp.Name = oldName;

            dB.Update(sp);

            Assert.IsTrue(dB.Get(sp.ID).Name == oldName, "Name not reverted");
        }
Пример #5
0
        public void AddRemoveEntityTest()
        {
            DBSalesPerson dB = new DBSalesPerson(this.dBConnect);

            var sp = new SalesPerson()
            {
                Name = "Johnny", Surname = "Test"
            };

            var ppl      = dB.GetAll();
            var oldCount = ppl.Count();

            dB.Create(sp);
            Assert.IsTrue(dB.GetAll().Count() > oldCount, "Salesperson not created");

            ppl = dB.GetAll();
            sp  = ppl.Last();

            dB.Delete(sp.ID);

            Assert.IsTrue(dB.GetAll().Count() == oldCount, "Salesperson not removed");
        }
Пример #6
0
        public void RemoveIllegalNegativeTest()
        {
            DBSalesPerson dB = new DBSalesPerson(this.dBConnect);

            dB.Delete(-1);
        }
 /// <summary>
 /// Constructor with Injected Database Entity Provider
 /// </summary>
 /// <param name="provider">DBSalesPerson Database entity</param>
 public SalesPersonController(DBSalesPerson provider)
 {
     this.provider = provider;
 }