public void Support(ISpecify specification) { this.ProvidedNumber = 3; var mock = specification.GetInstance<IAmAServiceDummy>(); A.CallTo(() => mock.DoSomething(1)).Returns(this.ProvidedNumber); }
public void Support(ISpecify specification) { this.ProvidedNumber = 3; var mock = specification.GetInstance <IAmAServiceDummy>(); A.CallTo(() => mock.DoSomething(1)).Returns(this.ProvidedNumber); }
public void Support(ISpecify specification) { var filler = new Filler<Person>(); filler.Setup().OnProperty(x => x.Numbers).IgnoreIt(); this.AvailablePersons = filler.Create(2); var personRepository = specification.GetInstance<IPersonRepository>(); A.CallTo(() => personRepository.GetAllPersons()).Returns(this.AvailablePersons); A.CallTo(() => personRepository.GetPerson(A<int>.Ignored)) .ReturnsLazily((int id) => this.AvailablePersons.First(p => p.Id == id)); }
public void Support(ISpecify specification) { var filler = new Filler<Person>(); filler.Setup() .OnProperty(x => x.Error) .IgnoreIt() .OnProperty(x => x.Id) .IgnoreIt() .OnProperty(x => x.Numbers) .IgnoreIt() .OnProperty(x => x.BirthDate) .Use(new DateTimeRange(new DateTime(1851, 1, 1), DateTime.Now)); this.Person = filler.Create(); }
public void Support(ISpecify specification) { var databaseSpecification = specification as INeedDataBaseContext; if (databaseSpecification == null) { throw new InvalidOperationException("Specification must implement INeedDataBaseContext to get access to a data base."); } var context = databaseSpecification.Context; var filler = new Filler<Person>(); filler.Setup().OnProperty(x => x.Id).IgnoreIt(); this.AvailablePersons = filler.Create(2); context.Persons.AddRange(this.AvailablePersons); context.SaveChanges(); }
public void Support(ISpecify specification, int data) { specification.GetInstance <DataContainer>().Data = data; }