public ActionResult GetPackages()
        {
            var packages = new List <PackageDto> {
                PackageTestFixtures.GetDtoWithTwoShapes()
            };

            return(this.Direct(new { success = true, data = packages }));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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;
                }
            }
        }
 private Package GetPackageWithTwoShapes()
 {
     return(PackageServices.WithDto(PackageTestFixtures.GetDtoWithTwoShapes()).Get());
 }