public void Markups_by_ancestors_should_be_returned() { var markupSubject = new MarkupSubjectInfo { AgencyAncestors = new List <int> { 2, 3 }, AgencyId = 1, AgentId = 1, CountryHtId = "Russia", LocalityHtId = "Moscow" }; var markupDestination = GetDummyMarkupDestination(); var markupPolicies = new List <MarkupPolicy> { new() { Id = 1, Order = 1, SubjectScopeType = SubjectMarkupScopeTypes.Agency, SubjectScopeId = "1", DestinationScopeType = DestinationMarkupScopeTypes.Global }, new() { Id = 2, Order = 2, SubjectScopeType = SubjectMarkupScopeTypes.Agency, SubjectScopeId = "2", DestinationScopeType = DestinationMarkupScopeTypes.Global }, new() { Id = 3, Order = 1, SubjectScopeType = SubjectMarkupScopeTypes.Agency, SubjectScopeId = "3", DestinationScopeType = DestinationMarkupScopeTypes.Global }, new() { Id = 4, Order = 1, SubjectScopeType = SubjectMarkupScopeTypes.Agency, SubjectScopeId = "4", DestinationScopeType = DestinationMarkupScopeTypes.Global } }; var service = MarkupPolicyServiceMock.Create(markupPolicies); var policies = service.Get(markupSubject, markupDestination, default); Assert.Equal(3, policies.Count); Assert.NotEqual(4, policies[0].Id); Assert.NotEqual(4, policies[1].Id); Assert.NotEqual(4, policies[2].Id); }
public void Ordering_by_agency_ancestors() { var markupSubject = new MarkupSubjectInfo { AgencyAncestors = new List <int> { 3, 2 }, AgencyId = 1, AgentId = 1, CountryHtId = "Russia", LocalityHtId = "Moscow" }; var markupDestination = new MarkupDestinationInfo { AccommodationHtId = "President Hotel", CountryHtId = "UAE", LocalityHtId = "Dubai" }; var markupPolicies = new List <MarkupPolicy> { new() { Id = 9, Order = 1, SubjectScopeType = SubjectMarkupScopeTypes.Agency, SubjectScopeId = "1", DestinationScopeType = DestinationMarkupScopeTypes.Global }, new() { Id = 7, Order = 4, SubjectScopeType = SubjectMarkupScopeTypes.Agency, SubjectScopeId = "2", DestinationScopeType = DestinationMarkupScopeTypes.Global }, new() { Id = 5, Order = 1, SubjectScopeType = SubjectMarkupScopeTypes.Agency, SubjectScopeId = "3", DestinationScopeType = DestinationMarkupScopeTypes.Global }, }; var service = MarkupPolicyServiceMock.Create(markupPolicies); var policies = service.Get(markupSubject, markupDestination, default); Assert.Equal("3", policies[0].SubjectScopeId); Assert.Equal("2", policies[1].SubjectScopeId); Assert.Equal("1", policies[2].SubjectScopeId); }
public void Markups_for_specific_agent_should_be_returned() { var markupSubject = new MarkupSubjectInfo { AgencyAncestors = new List <int>(), AgencyId = 1, AgentId = 1, CountryHtId = "Russia", LocalityHtId = "Moscow" }; var markupDestination = GetDummyMarkupDestination(); var markupPolicies = new List <MarkupPolicy> { new() { Id = 1, Order = 1, SubjectScopeType = SubjectMarkupScopeTypes.Agent, SubjectScopeId = AgentInAgencyId.Create(agentId: 1, agencyId: 1).ToString(), DestinationScopeType = DestinationMarkupScopeTypes.Global }, new() { Id = 2, Order = 2, SubjectScopeType = SubjectMarkupScopeTypes.Agent, SubjectScopeId = AgentInAgencyId.Create(agentId: 2, agencyId: 1).ToString(), DestinationScopeType = DestinationMarkupScopeTypes.Global, }, new() { Id = 3, Order = 1, SubjectScopeType = SubjectMarkupScopeTypes.Agent, SubjectScopeId = AgentInAgencyId.Create(agentId: 1, agencyId: 2).ToString(), DestinationScopeType = DestinationMarkupScopeTypes.Global } }; var service = MarkupPolicyServiceMock.Create(markupPolicies); var policies = service.Get(markupSubject, markupDestination, default); Assert.Single(policies); Assert.Equal(1, policies[0].Id); }
public void Specific_agent_and_specific_hotel() { var markupSubject = new MarkupSubjectInfo { AgencyAncestors = new List <int>(), AgencyId = 1, AgentId = 1, CountryHtId = "Russia", LocalityHtId = "Moscow" }; var markupDestination = new MarkupDestinationInfo { AccommodationHtId = "President Hotel", CountryHtId = "UAE", LocalityHtId = "Dubai" }; var markupPolicies = new List <MarkupPolicy> { new() { Id = 1, Order = 1, SubjectScopeType = SubjectMarkupScopeTypes.Agent, SubjectScopeId = AgentInAgencyId.Create(agentId: 1, agencyId: 1).ToString(), DestinationScopeType = DestinationMarkupScopeTypes.Accommodation, DestinationScopeId = "President Hotel" }, new() { Id = 2, Order = 2, SubjectScopeType = SubjectMarkupScopeTypes.Agent, SubjectScopeId = AgentInAgencyId.Create(agentId: 2, agencyId: 1).ToString(), DestinationScopeType = DestinationMarkupScopeTypes.Accommodation, DestinationScopeId = "President Hotel" } }; var service = MarkupPolicyServiceMock.Create(markupPolicies); var policies = service.Get(markupSubject, markupDestination, default); Assert.Single(policies); Assert.Equal(1, policies[0].Id); } }
public void Global_markups_should_be_returned() { var markupSubject = new MarkupSubjectInfo { AgencyAncestors = new List <int>(), AgencyId = 1, AgentId = 1, CountryHtId = "Russia", LocalityHtId = "Moscow" }; var markupDestination = new MarkupDestinationInfo { AccommodationHtId = "President Hotel", CountryHtId = "UAE", LocalityHtId = "Dubai" }; var markupPolicies = new List <MarkupPolicy> { new() { Id = 1, Order = 1, SubjectScopeType = SubjectMarkupScopeTypes.Global, DestinationScopeType = DestinationMarkupScopeTypes.Global }, new() { Id = 2, Order = 2, SubjectScopeType = SubjectMarkupScopeTypes.Locality, SubjectScopeId = "Kiev", DestinationScopeType = DestinationMarkupScopeTypes.Global } }; var service = MarkupPolicyServiceMock.Create(markupPolicies); var policies = service.Get(markupSubject, markupDestination, default); Assert.Single(policies); Assert.Equal(1, policies[0].Id); }
public void Markups_for_specific_hotel_should_be_returned() { var markupSubject = GetDummyMarkupSubject(); var markupDestination = new MarkupDestinationInfo { AccommodationHtId = "President Hotel", CountryHtId = "UAE", LocalityHtId = "Dubai" }; var markupPolicies = new List <MarkupPolicy> { new() { Id = 1, Order = 1, SubjectScopeType = SubjectMarkupScopeTypes.Global, DestinationScopeType = DestinationMarkupScopeTypes.Accommodation, DestinationScopeId = "President Hotel" }, new() { Id = 2, Order = 2, SubjectScopeType = SubjectMarkupScopeTypes.Global, DestinationScopeType = DestinationMarkupScopeTypes.Accommodation, DestinationScopeId = "Hilton" } }; var service = MarkupPolicyServiceMock.Create(markupPolicies); var policies = service.Get(markupSubject, markupDestination, default); Assert.Single(policies); Assert.Equal(1, policies[0].Id); }
public void Ordering_by_subject_scope_type() { var markupSubject = new MarkupSubjectInfo { AgencyAncestors = new List <int>(), AgencyId = 1, AgentId = 1, CountryHtId = "Russia", LocalityHtId = "Moscow" }; var markupDestination = new MarkupDestinationInfo { AccommodationHtId = "President Hotel", CountryHtId = "UAE", LocalityHtId = "Dubai" }; var markupPolicies = new List <MarkupPolicy> { new() { Id = 9, Order = 1, SubjectScopeType = SubjectMarkupScopeTypes.Global, DestinationScopeType = DestinationMarkupScopeTypes.Country, DestinationScopeId = "UAE" }, new() { Id = 7, Order = 4, SubjectScopeType = SubjectMarkupScopeTypes.Global, DestinationScopeType = DestinationMarkupScopeTypes.Global }, new() { Id = 5, Order = 1, SubjectScopeType = SubjectMarkupScopeTypes.Global, DestinationScopeType = DestinationMarkupScopeTypes.Accommodation, DestinationScopeId = "President Hotel" }, new() { Id = 2, Order = 2, SubjectScopeType = SubjectMarkupScopeTypes.Global, DestinationScopeType = DestinationMarkupScopeTypes.Locality, DestinationScopeId = "Dubai" } }; var service = MarkupPolicyServiceMock.Create(markupPolicies); var policies = service.Get(markupSubject, markupDestination, default); Assert.Equal(DestinationMarkupScopeTypes.Global, policies[0].DestinationScopeType); Assert.Equal(DestinationMarkupScopeTypes.Country, policies[1].DestinationScopeType); Assert.Equal(DestinationMarkupScopeTypes.Locality, policies[2].DestinationScopeType); Assert.Equal(DestinationMarkupScopeTypes.Accommodation, policies[3].DestinationScopeType); } }