Esempio n. 1
0
            public void ValidBusinessIdReturnsPopulatedResultSet()
            {
                //Arrange
                var dao = new PromotionDao();

                //Act
                var result = dao.GetByBusiness(ValidBusiness);

                //Assert
                Assert.NotNull(result, "No result set was returned at all");
                Assert.AreEqual(3, result.Count, "Unexpected number of results returned");
                var one = result.FirstOrDefault(x => x.Name.Equals("Active-10-AllDays-Always-5"));
                var two = result.FirstOrDefault(x => x.Name.Equals("Active-20-SomeDays-EarlyBird-10"));
                var three = result.FirstOrDefault(x => x.Name.Equals("Inactive-30-NoDays-LateArrival-15"));

                Assert.NotNull(one, "Promotion Active-10-AllDays-Always-5 not found in resultset.");
                Assert.NotNull(two, "Promotion Active-20-SomeDays-EarlyBird-10 not found in resultset.");
                Assert.NotNull(three, "Promotion Inactive-30-NoDays-LateArrival-15 not found in resultset.");

                Assert.AreEqual(PromotionStatusEnum.Active, one.Status.Type, "Error loading Promotion Statuses");
                Assert.AreEqual(PromotionStatusEnum.Active, two.Status.Type, "Error loading Promotion Statuses");
                Assert.AreEqual(PromotionStatusEnum.Inactive, three.Status.Type, "Error loading Promotion Statuses");

                Assert.AreEqual(10, one.Discount, "Error loading Discounts");
                Assert.AreEqual(20, two.Discount, "Error loading Discounts");
                Assert.AreEqual(30, three.Discount, "Error loading Discounts");

                Assert.AreEqual("1111111", one.ApplicableDaysString, "Error loading Applicable Days");
                Assert.AreEqual("1010101", two.ApplicableDaysString, "Error loading Applicable Days");
                Assert.AreEqual("0000000", three.ApplicableDaysString, "Error loading Applicable Days");

                Assert.AreEqual(AvailableStatus.Always, one.AvailableStatus, "Error loading AvailableStatus");
                Assert.AreEqual(AvailableStatus.EarlyBird, two.AvailableStatus, "Error loading AvailableStatus");
                Assert.AreEqual(AvailableStatus.LateArrival, three.AvailableStatus, "Error loading AvailableStatus");

                Assert.AreEqual(5, one.AvailableHours, "Error loading Available Hours");
                Assert.AreEqual(10, two.AvailableHours, "Error loading Available Hours");
                Assert.AreEqual(15, three.AvailableHours, "Error loading Available Hours");
            }
Esempio n. 2
0
            public void InvalidBusinessIdReturnsEmptyResultSet()
            {
                //Arrange
                var dao = new PromotionDao();

                //Act
                var result = dao.GetByBusiness(-ValidBusiness);

                //Assert
                Assert.NotNull(result, "No result set was returned at all");
                Assert.AreEqual(0, result.Count, "Results were returned on a Business Id with no Promotions");
            }