Beispiel #1
0
            private CommencementDateControllerTestContext()
            {
                PrimaryOrganisationId = Guid.NewGuid();
                Order = new Order {
                    OrganisationId = PrimaryOrganisationId
                };
                OrderRepositoryMock = new Mock <IOrderRepository>();
                OrderRepositoryMock.Setup(x => x.GetOrderByIdAsync(It.IsAny <string>())).ReturnsAsync(() => Order);
                ClaimsPrincipal = new ClaimsPrincipal(new ClaimsIdentity(new[]
                {
                    new Claim("Ordering", "Manage"),
                    new Claim("primaryOrganisationId", PrimaryOrganisationId.ToString()),
                    new Claim(ClaimTypes.Name, "Test User"),
                    new Claim(ClaimTypes.NameIdentifier, Guid.NewGuid().ToString())
                }, "mock"));

                Controller = new CommencementDateController(OrderRepositoryMock.Object)
                {
                    ControllerContext = new ControllerContext
                    {
                        HttpContext = new DefaultHttpContext {
                            User = ClaimsPrincipal
                        }
                    }
                };
            }
Beispiel #2
0
        public bool Equals(CreateBuyerRequest other)
        {
            if (other is null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(PrimaryOrganisationId.Equals(other.PrimaryOrganisationId) &&
                   string.Equals(FirstName, other.FirstName, StringComparison.Ordinal) &&
                   string.Equals(LastName, other.LastName, StringComparison.Ordinal) &&
                   string.Equals(PhoneNumber, other.PhoneNumber, StringComparison.Ordinal) &&
                   string.Equals(EmailAddress, other.EmailAddress, StringComparison.Ordinal));
        }
Beispiel #3
0
            private ServiceRecipientsTestContext()
            {
                PrimaryOrganisationId = Guid.NewGuid();
                UserId   = Guid.NewGuid();
                Username = "******";

                Order = new Order {
                    OrganisationId = PrimaryOrganisationId
                };

                OrderRepositoryMock = new Mock <IOrderRepository>();
                OrderRepositoryMock.Setup(x => x.GetOrderByIdAsync(It.IsAny <string>())).ReturnsAsync(() => Order);

                ServiceRecipientRepositoryMock = new Mock <IServiceRecipientRepository>();
                ServiceRecipients = new List <ServiceRecipient>();
                ServiceRecipientRepositoryMock.Setup(x => x.ListServiceRecipientsByOrderIdAsync(It.IsAny <string>()))
                .ReturnsAsync(() => ServiceRecipients);

                ClaimsPrincipal = new ClaimsPrincipal(new ClaimsIdentity(new[]
                {
                    new Claim("Ordering", "Manage"),
                    new Claim("primaryOrganisationId", PrimaryOrganisationId.ToString()),
                    new Claim(ClaimTypes.Name, Username),
                    new Claim(ClaimTypes.NameIdentifier, UserId.ToString())
                },
                                                                         "mock"));

                Controller = new ServiceRecipientsSectionController(OrderRepositoryMock.Object, ServiceRecipientRepositoryMock.Object)
                {
                    ControllerContext = new ControllerContext
                    {
                        HttpContext = new DefaultHttpContext {
                            User = ClaimsPrincipal
                        }
                    }
                };
            }