Ejemplo n.º 1
0
        public void FactoryTypeMock()
        {
            Dx.Test("My test")
                .Arrange(bag =>
                {
                    bag.entityNumber = 2;
                    bag.commandId = 55;
                    bag.factory
                        .GetRepo(true)
                        .GetEntity(Dx.Args<int>(a => a == bag.commandId))
                        .DxReturns(new Add.Entity { Number = bag.entityNumber });
                })

                .UseParentAct()
                .Act(bag =>
                {
                    bag.add = 55;
                    var subject = new Add(bag.factory.DxAs<RepoFactory>());
                    return subject.Execute2(bag.commandId, bag.add);
                })

                .SkipParentAssert()
                .Assert((bag, result) =>
                {
                    if (result != 110)
                        throw new InvalidOperationException();
                })

                .Run();
        }