Пример #1
0
        public void CheckRules()
        {
            //Arrange
            using (var db = new DBIntegrationContext())
            {
                var newRule = new NewCustomerIntegration.Domain.Models.Rule();

                newRule.ValueTypeId      = 16;
                newRule.RuleName         = "Substitution";
                newRule.RuleDescription  = "Substitute out of stock item with closest like item";
                newRule.CreatedDateTime  = new DateTime();
                newRule.CreatedBy        = "Administrator";
                newRule.ModifiedDateTime = new DateTime();
                newRule.ModifiedBy       = "Administrator";
                db.Rules.Add(newRule);

                //Act
                db.SaveChanges();

                //Assert -- See if the record retrieved matches the one just entered
                var saveRules = (from d in db.Rules where d.RuleId == newRule.RuleId select d).Single();

                Assert.AreEqual(saveRules.ValueTypeId, newRule.ValueTypeId);
                Assert.AreEqual(saveRules.RuleName, newRule.RuleName);
                Assert.AreEqual(saveRules.RuleDescription, newRule.RuleDescription);
                Assert.AreEqual(saveRules.CreatedDateTime, newRule.CreatedDateTime);
                Assert.AreEqual(saveRules.CreatedBy, newRule.CreatedBy);
                Assert.AreEqual(saveRules.ModifiedDateTime, newRule.ModifiedDateTime);
                Assert.AreEqual(saveRules.ModifiedBy, newRule.ModifiedBy);

                //Cleanup
                db.Rules.Remove(newRule);
                db.SaveChanges();
            }
        }
Пример #2
0
        public void CheckRules()
        {
            //Arrange
            using (var db = new DBIntegrationContext())
            {
                var newRule = new NewCustomerIntegration.Domain.Models.Rule();

                newRule.ValueTypeId = 16;
                newRule.RuleName = "Substitution";
                newRule.RuleDescription = "Substitute out of stock item with closest like item";
                newRule.CreatedDateTime = new DateTime();
                newRule.CreatedBy = "Administrator";
                newRule.ModifiedDateTime = new DateTime();
                newRule.ModifiedBy = "Administrator";
                db.Rules.Add(newRule);

                //Act
                db.SaveChanges();

                //Assert -- See if the record retrieved matches the one just entered
                var saveRules = (from d in db.Rules where d.RuleId == newRule.RuleId select d).Single();

                Assert.AreEqual(saveRules.ValueTypeId, newRule.ValueTypeId);
                Assert.AreEqual(saveRules.RuleName, newRule.RuleName );
                Assert.AreEqual(saveRules.RuleDescription, newRule.RuleDescription);
                Assert.AreEqual(saveRules.CreatedDateTime, newRule.CreatedDateTime);
                Assert.AreEqual(saveRules.CreatedBy, newRule.CreatedBy);
                Assert.AreEqual(saveRules.ModifiedDateTime, newRule.ModifiedDateTime);
                Assert.AreEqual(saveRules.ModifiedBy, newRule.ModifiedBy);

                //Cleanup
                db.Rules.Remove(newRule);
                db.SaveChanges();
            }
        }