public void ThatAPackageCanBeFound() { var package = PackageServices.WithDto(PackageTestFixtures.GetAmpulDto()).Get(); Assert.AreEqual(package, PackageServices.Packages.Single(x => x.Name == package.Name)); }
public ActionResult GetPackages() { var packages = new List <PackageDto> { PackageTestFixtures.GetDtoWithTwoShapes() }; return(this.Direct(new { success = true, data = packages })); }
public void ThatPackageWithoutAbbreviationThrowsException() { var dto = PackageTestFixtures.GetAmpulDto(); dto.Abbreviation = String.Empty; AssertCreateFails(dto); }
public ActionResult GetPackage(JObject id) { if (CheckIfIdIsEmpty(id, "id")) { return(this.Direct(new { success = false })); } var shape = PackageTestFixtures.CreatePackageAmpul(); return(this.Direct(new { success = true, result = shape })); }
public void NotAddFoundEntityToRepository() { var factory = new PackageFactory(PackageTestFixtures.GetDtoWithTwoShapes()); var package = Isolate.Fake.Instance <Package>(); var repos = Isolate.Fake.Instance <IRepository <Package> >(); Isolate.NonPublic.WhenCalled(factory, "Find").WillReturn(package); Isolate.WhenCalled(() => repos.Add(package)).IgnoreCall(); factory.Get(); Isolate.Verify.WasNotCalled(() => repos.Add(package)); }
public void ThatProductCanBeCreatedUsingFluentConstructor() { var product = Product.Create(ProductTestFixtures.GetProductDtoWithNoSubstances()) .Shape(ShapeTestFixtures.CreateIvFluidShape()) .Package(PackageTestFixtures.CreatePackageAmpul()) .Quantity(UnitTestFixtures.CreateUnitMililiter(), 5M) .Substance(1, SubstanceTestFixtures.CreateSubstanceWithoutGroup(), 200, UnitTestFixtures.CreateUnitMilligram()) .Route(RouteTestFixtures.CreateRouteIv()); Assert.IsInstanceOfType(product, typeof(Product)); }
public void ThatProductCreateFailsWhenNoShape() { var dto = ProductTestFixtures.GetProductDtoWithNoSubstances(); var package = PackageTestFixtures.CreatePackageAmpul(); const decimal prodQuantity = 5M; var unit = UnitTestFixtures.CreateUnitMililiter(); var subst = SubstanceTestFixtures.CreateSubstanceWithoutGroup(); const int order = 1; const decimal quantity = 200; var substUnit = UnitTestFixtures.CreateUnitMilligram(); var route = RouteTestFixtures.CreateRouteIv(); AssertCreateFails(quantity, subst, substUnit, route, order, null, dto, package, prodQuantity, unit); }
public void NotCreateEntityIfFound() { var factory = new PackageFactory(PackageTestFixtures.GetDtoWithTwoShapes()); var package = Isolate.Fake.Instance <Package>(); Isolate.NonPublic.WhenCalled(factory, "Find").WillReturn(package); factory.Get(); try { Isolate.Verify.NonPublic.WasCalled(factory, "Create"); Assert.Fail(); } catch (Exception e) { if (e.GetType() != typeof(VerifyException)) { throw; } } }
public void ThatPackageCanBeFoundByName() { var package = PackageServices.WithDto(PackageTestFixtures.GetAmpulDto()).Get(); Assert.AreEqual(package, PackageServices.GetByName(package.Name)); }
private static Package GetPackageWithoutShape() { var package = PackageServices.WithDto(PackageTestFixtures.GetAmpulDto()).Get(); return(package); }
private Package GetPackageWithTwoShapes() { return(PackageServices.WithDto(PackageTestFixtures.GetDtoWithTwoShapes()).Get()); }
private static Package GetPackageWithShape() { return(PackageServices.WithDto(PackageTestFixtures.GetDtoWithOneShape()).Get()); }
public void ThatAValidPackageCanBeConstructed() { var package = PackageTestFixtures.CreatePackageAmpul(); Assert.IsTrue(PackageIsValid(package)); }