예제 #1
0
        public SearchViewModelTest()
        {
            this.actionBuilder = new ActionBuilderMock();

            this.testee = new SearchViewModel()
                          .AttachBuilder(this.actionBuilder);
        }
예제 #2
0
        public SearchViewModelTest()
        {
            this.actionBuilder = new ActionBuilderMock();

            this.testee = new SearchViewModel()
                .AttachBuilder(this.actionBuilder);
        }
예제 #3
0
            public async Task Not_return_deleted_costs()
            {
                // Arrange
                var costId = Guid.NewGuid();
                var cost   = new Cost
                {
                    Id      = costId,
                    Deleted = true
                };
                var userId = Guid.NewGuid();
                var user   = new UserIdentity {
                    Id = userId
                };

                ActionBuilderMock.Setup(a => a.GetActions(It.IsAny <IEnumerable <Guid> >(), user))
                .ReturnsAsync(new Dictionary <Guid, CostActionsModel> {
                    {
                        costId,
                        new CostActionsModel(cost, new Dictionary <string, ActionModel>())
                    }
                }
                              );

                EFContext.Cost.Add(cost);
                await EFContext.SaveChangesAsync();

                var costQuery = new CostQuery();

                SearchServiceMock.Setup(ss => ss.SearchCosts(costQuery, user.Id)).ReturnsAsync((
                                                                                                   new[] {
                    new CostSearchItem
                    {
                        Id = costId.ToString(),
                        CreatedBy = userId.ToString()
                    }
                },
                                                                                                   1)
                                                                                               );

                // Act
                var searchResult = await CostService.Search(costQuery, user);

                // Assert
                searchResult.Count.Should().Be(0);
                searchResult.Costs.Count.Should().Be(0);
            }