public void ThatAddedShapeCanBeFound() { var shape = ShapeServices.WithDto(ShapeTestFixtures.GetIvFluidDto()).Get(); Assert.AreEqual(shape, ShapeServices.Shapes.Single( x => x.Name == shape.Name)); }
public void ThatShapePackageRelationshipIsBiDirectional() { var package = PackageServices.WithDto(GetPackageDto()).Get(); var shape = ShapeServices.WithDto(ShapeTestFixtures.GetValidDtoWithPackages()).Get(); Assert.AreEqual(shape, package.ShapeSet.First()); }
public void ThatShapeIsAssociatedWithPackage() { var package = PackageServices.WithDto(GetPackageDto()).Get(); var shape = ShapeServices.WithDto(ShapeTestFixtures.GetValidDtoWithPackages()).Get(); Assert.AreEqual(shape.PackageSet.Single(p => p.Name == package.Name), package); }
public void ThatShapeWithUnitGroupsCanBeDeletedLeavingUnitGroups() { var shape = ShapeServices.WithDto(ShapeTestFixtures.GetValidDtoWithUnitGroups()).Get(); ShapeServices.Delete(shape); Assert.IsNotNull(UnitGroupServices.UnitGroups.SingleOrDefault(x => x.Name == ShapeTestFixtures.GetValidDtoWithUnitGroups().UnitGroups.First().Name)); }
public void ThatShapeUnitGroupRelationshipIsBiDirectional() { var unitGroup = UnitGroupServices.WithDto(GetUnitGroupDto()).Get(); var shape = ShapeServices.WithDto(ShapeTestFixtures.GetValidDtoWithUnitGroups()).Get(); Assert.AreEqual(shape, unitGroup.Shapes.First()); }
public void ThatShapeIsAssociatedWithUnitGroup() { var unitGroup = UnitGroupServices.WithDto(GetUnitGroupDto()).Get(); var shape = ShapeServices.WithDto(ShapeTestFixtures.GetValidDtoWithUnitGroups()).Get(); Assert.AreEqual(shape.UnitGroupSet.Single(p => p.Name == unitGroup.Name), unitGroup); }
public void ThatShapeRouteRelationshipIsBiDirectional() { var route = RouteServices.WithDto(GetRouteDto()).Get(); var shape = ShapeServices.WithDto(ShapeTestFixtures.GetValidDtoWithRoutes()).Get(); Assert.AreEqual(shape, route.ShapeSet.First()); }
public void ThatShapeWithAfterDeleteLeavesPackage() { var shape = ShapeServices.WithDto(ShapeTestFixtures.GetValidDtoWithPackages()).Get(); ShapeServices.Delete(shape); Assert.IsNotNull(PackageServices.Packages.SingleOrDefault(x => x.Name == ShapeTestFixtures.GetValidDtoWithPackages().Packages.First().Name)); }
public void ThatShapeCanBeDeleted() { var shape = ShapeServices.WithDto(ShapeTestFixtures.GetIvFluidDto()).Get(); ShapeServices.Delete(shape); Assert.IsNull(ShapeServices.Shapes.SingleOrDefault(x => x.Name == ShapeTestFixtures.GetIvFluidDto().Name)); }
public void ThatShapeCanBeUpdated() { var shape = ShapeServices.WithDto(ShapeTestFixtures.GetIvFluidDto()).Get(); // ToDo: rewrite // shape.Environment = shape.Environment + "_changed"; Assert.IsNotNull(ShapeServices.Shapes.SingleOrDefault(x => x.Name == shape.Name)); }
public ActionResult GetShapes() { var shapes = new List <ShapeDto> { ShapeTestFixtures.GetValidDtoWithUnitGroups() }; return(this.Direct(new { success = true, data = shapes })); }
public void ThatShapeIsAssociatedWithRoute() { var route = RouteServices.WithDto(GetRouteDto()).Get(); var shape = ShapeServices.WithDto(ShapeTestFixtures.GetValidDtoWithRoutes()).Get(); var list = new List <IRoute>(shape.Routes); Assert.AreEqual(list.Single(p => p.Name == route.Name), route); }
public void AValidShapeWithPackagesCanBeConstructed() { var shape = Shape.Create(ShapeTestFixtures.GetValidDtoWithPackages()); var package1 = Package.Create(ShapeTestFixtures.GetValidDtoWithPackages().Packages.First()); var package2 = Package.Create(ShapeTestFixtures.GetValidDtoWithPackages().Packages.Last()); shape.AddPackage(package1); shape.AddPackage(package2); Assert.IsTrue(ShapeIsValid(shape) && ShapeContainsPackages(shape)); }
public ActionResult GetShape(JObject id) { if (CheckIfIdIsEmpty(id, "id")) { return(this.Direct(new { success = false })); } var shape = ShapeTestFixtures.GetValidDtoWithUnitGroups(); return(this.Direct(new { success = true, result = shape })); }
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 ThatShapeWithoutNameThrowsException() { try { var dto = ShapeTestFixtures.GetIvFluidDto(); dto.Name = String.Empty; Shape.Create(dto); Assert.Fail(); } catch (Exception e) { Assert.IsNotInstanceOfType(e, typeof(AssertFailedException)); } }
public void ThatProductCreateFailsWhenProductHasNoRoute() { var dto = ProductTestFixtures.GetProductDtoWithNoSubstances(); var shape = ShapeTestFixtures.CreateIvFluidShape(); 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(); AssertCreateFails(quantity, subst, substUnit, null, order, shape, dto, package, prodQuantity, unit); }
public void AValidShapeCanBeConstucted() { var shape = ShapeTestFixtures.CreateIvFluidShape(); Assert.IsTrue(ShapeIsValid(shape)); }
private UnitGroupDto GetUnitGroupDto() { return(ShapeTestFixtures.GetValidDtoWithUnitGroups().UnitGroups.First()); }
private PackageDto GetPackageDto() { return(ShapeTestFixtures.GetValidDtoWithPackages().Packages.First()); }
public void ThatShapeCanBeGet() { var shape = ShapeServices.WithDto(ShapeTestFixtures.GetIvFluidDto()).Get(); Assert.IsNotNull(shape); }
private RouteDto GetRouteDto() { return(ShapeTestFixtures.GetValidDtoWithRoutes().Routes.First()); }