예제 #1
0
        public void GetByClientHaspKey()
        {
            List <HaspKey> getByClient;
            var            getByClientExpected = new List <HaspKey>
            {
                CreateNew(1),
            };

            var client = new Client
            {
                Id   = 1,
                Name = "Ivanov Ivan",
            };

            using (var db = new EntitesContext())
            {
                ClearTable.HaspKeys(db);
                ClearTable.KeyFeatures(db);
                ClearTable.KeyFeatureClients(db);

                haspKeyL = Get(db);
                db.HaspKeys.AddRange(CreateListEntities.HaspKeys());
                db.KeyFeatures.AddRange(CreateListEntities.KeyFeatures());
                db.KeyFeatureClients.AddRange(CreateListEntities.KeyFeatureClients());
                db.SaveChanges();

                getByClient = haspKeyL.GetByClient(client);
            }

            CollectionAssert.AreEqual(getByClient, getByClientExpected);
        }
예제 #2
0
 public void GetByNullClientHaspKey()
 {
     using (var db = new EntitesContext())
     {
         haspKeyL = Get(db);
         Assert.ThrowsException <ArgumentNullException>(() => haspKeyL.GetByClient(null));
     }
 }
예제 #3
0
        public List <ModelViewHaspKey> GetByClient(ModelViewClient client)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            return(Convert(keyLogic.GetByClient(client.Client)));
        }