Exemple #1
0
        public async Task GetAddressesByStreetShouldReturnOkIfFoundInDatabase()
        {
            // Arrange
            var street  = "Ciasna";
            var address = new Address()
            {
                Id             = 1,
                Country        = "Polska",
                City           = "Sopot",
                Street         = street,
                BuildingNumber = "1",
                FlatNumber     = "69",
                PostalCode     = "80-765"
            };

            mockRepo.Setup(x => x.Address).Returns(_addressRepoMock.Object);
            _addressRepoMock.Setup(x => x.GetAddressByStreet(street)).ReturnsAsync(new[] { address });

            // Act
            var result = await _sut.GetAddressesByStreet(street);

            // Assert
            Assert.IsType <OkObjectResult>(result);
            Assert.IsNotType <NotFoundResult>(result);
        }