public void GetsAllFromTheGateway()
        {
            var stubbedEntities = _fixture.CreateMany <Entity>().ToList();

            _mockGateway.Setup(x => x.GetAll()).Returns(stubbedEntities);

            var expectedResponse = new ResponseObjectList {
                ResponseObjects = stubbedEntities.ToResponse()
            };

            _classUnderTest.Execute().Should().BeEquivalentTo(expectedResponse);
        }
Пример #2
0
        public void GetsAllFromTheGateway()
        {
            var stubbedEntities = _fixture.Create <Entity>();
            var parameter       = _fixture.Create <RequestQueryParameter>();

            _mockGateway.Setup(x => x.GetEntityById(parameter)).Returns(stubbedEntities);

            var expectedResponse = new ResponseObject {
            };

            _classUnderTest.Execute(parameter).Should().BeEquivalentTo(expectedResponse);
        }
Пример #3
0
        public void ReturnsResidentInformationList()
        {
            var stubbedResidents = _fixture
                                   .Build <ResidentDomain>()
                                   .Without(contact => contact.Contacts)
                                   .CreateMany();

            SetupMockGatewayToExpectParameters(firstNameQuery: "ciasom", lastNameQuery: "tessellate",
                                               stubbedResidents: stubbedResidents.ToList());

            var rqp = new ResidentQueryParam
            {
                FirstName = "ciasom",
                LastName  = "tessellate"
            };

            var response = _classUnderTest.Execute(rqp);

            response.Should().NotBeNull();
            response.Residents.Should().BeEquivalentTo(stubbedResidents.ToResponse());
        }
Пример #4
0
        public void NoProductsAvailable_ShouldReturnEmptyList()
        {
            // Arrange
            var repository = GetEmptyProductRepository();
            var sut        = new GetAllUseCase(repository);

            // Act
            var actual = sut.Execute();

            // Assert
            actual
            .Should()
            .BeEmpty();
        }
Пример #5
0
        public async Task GetAllUseCase_NoItemsExist_ShouldReturnEmptyList()
        {
            // Arrange
            var repository = new FakeSimpleEntityEmptyListRepository();
            var presenter  = new FakeGetAllOutputHandler();

            var sut = new GetAllUseCase(presenter, repository);

            // Act
            await sut.Execute();

            // Assert
            presenter.ViewModel
            .Should()
            .BeEquivalentTo(repository.Data);
        }
Пример #6
0
        public void ProductsAvailable_ShouldReturnAListOfProducts()
        {
            // Arrange
            var repository = GetProductRepository();
            var sut        = new GetAllUseCase(repository);

            // Act
            var actual = sut.Execute();

            // Assert
            actual
            .Should()
            .NotBeEmpty();

            actual.Count
            .Should()
            .Be(1);
        }