Example #1
0
        public void CreateHoliday_MustCreateInstaceOfHoliday(string id, string status, string typeProcess, string user, string country, string state, string date, string type, bool optional, string nativeDescription, string alternativeDescription, string countryCode, string stateCode, string cityName, string cityCode)
        {
            // Arrange
            Holiday      holiday;
            Guid         entityId     = string.IsNullOrEmpty(id) ? Guid.Empty : Guid.Parse(id);
            EntityStatus entityStatus = EntityStatus.GetByName(status);
            ActionType   action       = ActionType.GetByName(typeProcess);
            Guid         userId       = string.IsNullOrEmpty(user) ? Guid.Empty : Guid.Parse(user);
            Guid         countryId    = string.IsNullOrEmpty(country) ? Guid.Empty : Guid.Parse(country);
            Guid         stateId      = string.IsNullOrEmpty(state) ? Guid.Empty : Guid.Parse(state);
            DateTime     holidayDate  = DateTime.Parse(date);
            HolidayType  holidayType  = HolidayType.GetByName(type);

            // Act
            holiday = Holiday.CreateHoliday(entityId, entityStatus, action, userId, countryId, stateId, holidayDate, holidayType, optional, nativeDescription, alternativeDescription, countryCode, stateCode, cityName, cityCode);

            // Assert
            Assert.NotNull(holiday);
            Assert.True(holiday.Id != entityId &&
                        holiday.Status == entityStatus &&
                        holiday.Action == action &&
                        (holiday.RegisteredBy == userId || holiday.ModifiedBy == userId) &&
                        holiday.CountryId == countryId &&
                        holiday.StateId == stateId &&
                        holiday.HolidayDate == holidayDate &&
                        holiday.HolidayType == holidayType &&
                        holiday.Optional == optional &&
                        holiday.NativeDescription == nativeDescription &&
                        holiday.AlternativeDescription == alternativeDescription &&
                        holiday.CountryCode == countryCode &&
                        holiday.StateCode == stateCode &&
                        holiday.CityName == cityName &&
                        holiday.CityCode == cityCode);
        }
Example #2
0
        public void CreateCountry_MustCreateInstaceOfCountry(string id, string status, string typeProcess, string user, string numericCode, string alphaIsoCode2, string alphaIsoCode3, string name, string shortName, string languageCode, string regionName, string subRegionName, string intermediateRegionName, int regionCode, int subRegionCode, int intermediateRegionCode)
        {
            // Arrange
            Country      country;
            Guid         entityId     = string.IsNullOrEmpty(id) ? Guid.Empty : Guid.Parse(id);
            EntityStatus entityStatus = EntityStatus.GetByName(status);
            ActionType   action       = ActionType.GetByName(typeProcess);
            Guid         userId       = string.IsNullOrEmpty(user) ? Guid.Empty : Guid.Parse(user);

            // Act
            country = Country.CreateCountry(entityId, entityStatus, action, userId, numericCode, alphaIsoCode2, alphaIsoCode3, name, shortName, languageCode, regionName, subRegionName, intermediateRegionName, regionCode, subRegionCode, intermediateRegionCode, null);

            // Assert
            Assert.NotNull(country);
            Assert.True(country.Id != entityId &&
                        country.Status == entityStatus &&
                        country.Action == action &&
                        (country.RegisteredBy == userId || country.ModifiedBy == userId) &&
                        country.NumericCode == numericCode &&
                        country.CountryIsoCode2 == alphaIsoCode2 &&
                        country.CountryIsoCode3 == alphaIsoCode3 &&
                        country.Name == name &&
                        country.ShortName == shortName &&
                        country.LanguageCode == languageCode &&
                        country.RegionName == regionName &&
                        country.SubRegionName == subRegionName &&
                        country.IntermediateRegionName == intermediateRegionName &&
                        country.RegionCode == regionCode &&
                        country.IntermediateRegionCode == intermediateRegionCode);
        }
Example #3
0
        public void CreateRule_MustCreateInstaceOfRule(string id, string status, string typeProcess, string user, string country, string state, string countryIsoCode, string stateIsoCode, string cityCode, string cityName, string holidayType, string nativeHolidayName, string englishHolidayName, int month, int day, bool optional, string bussinessRule, string comments)
        {
            // Arrange
            RuleHoliday  ruleHoliday;
            Guid         entityId     = string.IsNullOrEmpty(id) ? Guid.Empty : Guid.Parse(id);
            EntityStatus entityStatus = EntityStatus.GetByName(status);
            ActionType   action       = ActionType.GetByName(typeProcess);
            HolidayType  type         = HolidayType.GetByName(holidayType);
            Guid         userId       = string.IsNullOrEmpty(user) ? Guid.Empty : Guid.Parse(user);
            Guid         countryId    = string.IsNullOrEmpty(country) ? Guid.Empty : Guid.Parse(country);
            Guid         stateId      = string.IsNullOrEmpty(state) ? Guid.Empty : Guid.Parse(state);

            // Act
            ruleHoliday = RuleHoliday.CreateRuleHoliday(entityId, entityStatus, action, userId, countryId, stateId, countryIsoCode, stateIsoCode, cityCode, cityName, type, nativeHolidayName, englishHolidayName, month, day, optional, bussinessRule, comments);

            // Assert
            Assert.NotNull(ruleHoliday);
            Assert.True(ruleHoliday.Id != entityId &&
                        ruleHoliday.Status == entityStatus &&
                        ruleHoliday.Action == action &&
                        (ruleHoliday.RegisteredBy == userId || ruleHoliday.ModifiedBy == userId) &&
                        ruleHoliday.CountryId == countryId &&
                        ruleHoliday.StateId == stateId &&
                        ruleHoliday.CountryIsoCode == countryIsoCode &&
                        ruleHoliday.StateIsoCode == stateIsoCode &&
                        ruleHoliday.CityCode == cityCode &&
                        ruleHoliday.CityName == cityName &&
                        ruleHoliday.HolidayType == type &&
                        ruleHoliday.NativeHolidayName == nativeHolidayName &&
                        ruleHoliday.EnglishHolidayName == englishHolidayName &&
                        (ruleHoliday.Month == month || ruleHoliday.Month == null) &&
                        (ruleHoliday.Day == day || ruleHoliday.Day == null) &&
                        ruleHoliday.Optional == optional &&
                        ruleHoliday.BussinessRule == bussinessRule.Replace(" ", "").Trim().ToLower() &&
                        ruleHoliday.Comments == comments);
        }
Example #4
0
        public void CreateState_MustCreateInstaceOfState(string id, string status, string typeProcess, string user, string country, string countryIsoCode, string stateIsoCode, string name)
        {
            // Arrange
            State        state;
            Guid         entityId     = string.IsNullOrEmpty(id) ? Guid.Empty : Guid.Parse(id);
            EntityStatus entityStatus = EntityStatus.GetByName(status);
            ActionType   action       = ActionType.GetByName(typeProcess);
            Guid         userId       = string.IsNullOrEmpty(user) ? Guid.Empty : Guid.Parse(user);
            Guid         countryId    = string.IsNullOrEmpty(country) ? Guid.Empty : Guid.Parse(country);

            // Act
            state = State.CreateState(entityId, entityStatus, action, userId, countryId, countryIsoCode, stateIsoCode, name, null);

            // Assert
            Assert.NotNull(state);
            Assert.True(state.Id != entityId &&
                        state.Status == entityStatus &&
                        state.Action == action &&
                        (state.RegisteredBy == userId || state.ModifiedBy == userId) &&
                        state.CountryId == countryId &&
                        state.CountryIsoCode == countryIsoCode &&
                        state.StateIsoCode == stateIsoCode &&
                        state.Name == name);
        }