コード例 #1
0
        public LocationServiceTestsFixture()
        {
            MapperHelper.CreateAutoMapper();

            CustomerProfileClientMock = new Mock <ICustomerProfileClient>(MockBehavior.Strict);
            LocationRepositoryMock    = new Mock <ILocationRepository>();
            GeocodingReaderMock       = new Mock <IGeocodingReader>();

            LocationService = new LocationService(
                CustomerProfileClientMock.Object,
                EmptyLogFactory.Instance,
                LocationRepositoryMock.Object,
                GeocodingReaderMock.Object);

            Partner = new Partner
            {
                Id               = Guid.NewGuid(),
                Name             = "Partner 1",
                Description      = "Partner 1 Desc",
                BusinessVertical = Vertical.Hospitality,
                ClientId         = "clientId1",
                CreatedAt        = DateTime.UtcNow,
                AmountInCurrency = 1,
                AmountInTokens   = 2,
                Locations        = new List <Location>
                {
                    new Location
                    {
                        Id            = LocationIds[0],
                        Name          = "Holiday Inn",
                        Address       = "Dubai",
                        CreatedAt     = DateTime.UtcNow,
                        ContactPerson = new ContactPerson
                        {
                            FirstName   = "Name 1",
                            LastName    = "Name 2",
                            Email       = "Email",
                            PhoneNumber = "Phone Number"
                        }
                    },
                    new Location
                    {
                        Id            = LocationIds[1],
                        Name          = "Holiday Relax",
                        Address       = "Bahri",
                        CreatedAt     = DateTime.UtcNow,
                        ContactPerson = new ContactPerson
                        {
                            FirstName   = "Name 1",
                            LastName    = "Name 2",
                            Email       = "Email",
                            PhoneNumber = "Phone Number"
                        }
                    },
                    new Location
                    {
                        Id            = LocationIds[2],
                        Name          = "Holiday Relax",
                        Address       = "Bahri",
                        CreatedAt     = DateTime.UtcNow,
                        ContactPerson = new ContactPerson
                        {
                            FirstName   = "Name 1",
                            LastName    = "Name 2",
                            Email       = "Email",
                            PhoneNumber = "Phone Number"
                        }
                    }
                }
            };

            PartnerContactResponse = new PartnerContactResponse
            {
                PartnerContact = new PartnerContact
                {
                    FirstName   = "Owner",
                    LastName    = "Johnson",
                    Email       = "*****@*****.**",
                    PhoneNumber = "123-123-123",
                    LocationId  = LocationIds[0].ToString()
                }
            };

            Partners = (new List <Partner>
            {
                Partner
            }.AsReadOnly(), 1);

            Location = new Location
            {
                Id            = LocationIds[2],
                Name          = "Holiday Relax",
                Address       = "Bahri",
                CreatedAt     = DateTime.UtcNow,
                ContactPerson = new ContactPerson
                {
                    FirstName   = "Name 1",
                    LastName    = "Name 2",
                    Email       = "Email",
                    PhoneNumber = "Phone Number"
                }
            };
        }
コード例 #2
0
        public PartnerServiceTestsFixture()
        {
            var mapper = MapperHelper.CreateAutoMapper();

            PartnerRepositoryMock       = new Mock <IPartnerRepository>(MockBehavior.Strict);
            LocationServiceMock         = new Mock <ILocationService>(MockBehavior.Strict);
            CredentialsClientMock       = new Mock <ICredentialsClient>(MockBehavior.Strict);
            CustomerProfileClientMock   = new Mock <ICustomerProfileClient>(MockBehavior.Strict);
            LocationsRepositoryMock     = new Mock <ILocationRepository>(MockBehavior.Strict);
            PartnerCreatedPublisherMock = new Mock <IRabbitPublisher <PartnerCreatedEvent> >(MockBehavior.Strict);

            PartnerService = new PartnerService(
                PartnerRepositoryMock.Object,
                LocationServiceMock.Object,
                CredentialsClientMock.Object,
                CustomerProfileClientMock.Object,
                LocationsRepositoryMock.Object,
                PartnerCreatedPublisherMock.Object,
                mapper,
                EmptyLogFactory.Instance);

            Partner = new Partner
            {
                Id               = Guid.NewGuid(),
                Name             = "Partner 1",
                Description      = "Partner 1 Desc",
                BusinessVertical = Vertical.Hospitality,
                ClientId         = "clientId1",
                CreatedAt        = DateTime.UtcNow,
                AmountInCurrency = 1,
                AmountInTokens   = 2,
                Locations        = new List <Location>
                {
                    new Location
                    {
                        Id            = LocationId,
                        Name          = "Holiday Inn",
                        Address       = "Dubai",
                        CreatedAt     = DateTime.UtcNow,
                        ContactPerson = null
                    },
                    new Location
                    {
                        Id            = Guid.NewGuid(),
                        Name          = "Holiday Relax",
                        Address       = "Bahri",
                        CreatedAt     = DateTime.UtcNow,
                        ContactPerson = null
                    }
                }
            };

            PartnerContactResponse = new PartnerContactResponse
            {
                PartnerContact = new PartnerContact
                {
                    FirstName   = "Owner",
                    LastName    = "Johnson",
                    Email       = "*****@*****.**",
                    PhoneNumber = "123-123-123",
                    LocationId  = LocationId.ToString()
                }
            };

            Partners = (new List <Partner>
            {
                Partner
            }.AsReadOnly(), 1);
        }