Exemplo n.º 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
                        }
                    }
                };
            }
Exemplo n.º 2
0
 public static async Task GetAsync_OrderNotFound_ReturnsNotFound(CommencementDateController controller)
 {
     var result = await controller.GetAsync(default);