コード例 #1
0
        public async Task GetUnitOfMeasuresAsync_Returns_UnitOfMeasures()
        {
            //Arrange
            var service = new UnitOfMeasureService(_myRestaurantContext);

            //Act
            var result = await service.GetUnitOfMeasuresAsync();

            //Assert
            result.Should().BeAssignableTo <IEnumerable <UnitOfMeasure> >();
            result.Should().HaveCount(5);
        }
コード例 #2
0
        public async Task AddUnitOfMeasureAsync_Returns_New_UnitOfMeasure()
        {
            //Arrange
            var service = new UnitOfMeasureService(_myRestaurantContext);

            //Act
            var result = await service.AddUnitOfMeasureAsync(new UnitOfMeasure { Code = "gal", Description = "gallon" });

            //Assert
            result.Should().BeAssignableTo <UnitOfMeasure>();
            result.Code.Should().Be("gal");
            result.Description.Should().Be("gallon");

            //Act
            var uoms = await service.GetUnitOfMeasuresAsync();

            //Assert
            uoms.Should().HaveCount(6);
        }