public void TestInitialize() { ObjectFactory = new ObjectFactory(); Interpeter = new Interpeter(ObjectFactory); Company = new Company(); Division = new Division(); SubDivision = new SubDivision(); ObjectFactory.Register <Company>(x => { CompanyCount++; return(Company); }); CompanyRepository = new CompanyRepository(Interpeter, ObjectFactory); CompanyRepository.FactoryMethods.Add(PossumLabs.Specflow.Core.Variables.Characteristics.None, (x) => x); Interpeter.Register(CompanyRepository); ObjectFactory.Register <Division>(x => { DivisionCount++; return(Division); }); DivisionRepository = new DivisionRepository(Interpeter, ObjectFactory); DivisionRepository.FactoryMethods.Add(PossumLabs.Specflow.Core.Variables.Characteristics.None, (x) => x); Interpeter.Register(DivisionRepository); ObjectFactory.Register <SubDivision>(x => { SubDivisionCount++; return(SubDivision); }); SubDivisionRepository = new SubDivisionRepository(Interpeter, ObjectFactory); SubDivisionRepository.FactoryMethods.Add(PossumLabs.Specflow.Core.Variables.Characteristics.None, (x) => x); Interpeter.Register(SubDivisionRepository); }
public void LeaveInitializedProperties() { var ret1 = new SubDivision(); ret1.Division = new Division(); SubDivisionRepository.DecorateNewItem(ret1); CompanyCount.Should().Be(0); DivisionCount.Should().Be(0); SubDivisionCount.Should().Be(0); }
public void PreventRepeatCalls() { var ret1 = new SubDivision(); SubDivisionRepository.DecorateNewItem(ret1); var ret2 = new SubDivision(); SubDivisionRepository.DecorateNewItem(ret2); CompanyCount.Should().Be(1); DivisionCount.Should().Be(1); SubDivisionCount.Should().Be(0); }