public FakeDataProviderTest() { var database = Database.GetDatabase("master"); this.dataStorage = Substitute.For<DataStorage>(database); this.dataProvider = new FakeDataProvider(this.dataStorage); ReflectionUtil.CallMethod(database, "AddDataProvider", new object[] { this.dataProvider }); }
public FakeDataProviderTest() { var database = Database.GetDatabase("master"); this.dataStorage = new DataStorage(database); this.dataStorage.FakeItems.Clear(); this.dataProvider = new FakeDataProvider(this.dataStorage); ReflectionUtil.CallMethod(database, "AddDataProvider", new object[] { this.dataProvider }); }
public FakeDataProviderTest() { var fixture = new Fixture(); fixture.Customize( new CompositeCustomization( new DefaultConventions(), new AutoNSubstituteCustomization(), new AutoConfiguredNSubstituteCustomization() )); this.dataStorageSwitcher = fixture.Create<DataStorageSwitcher>(); this.dataProvider = Substitute.ForPartsOf<FakeDataProvider>(); this.dataProvider.When(provider => provider.DataStorage()).DoNotCallBase(); this.dataProvider.DataStorage().Returns(info => fixture.Create<DataStorage>()); }
public void ChangeTemplateThrowsIfTemplateChangeListIsNull(FakeDataProvider sut, ItemDefinition def) { Action action = () => sut.ChangeTemplate(def, null, null); action.ShouldThrow<ArgumentNullException>(); }
public void ShouldResetPropertyAndReturnTheLatestValue(FakeDataProvider sut, string name, string value1, string value2, CallContext context) { sut.SetProperty(name, value1, context); sut.SetProperty(name, value2, context); sut.GetProperty(name, context).Should().Be(value2); }
public void ShouldreturnNullIfNoPropertySet(FakeDataProvider sut, string name, CallContext context) { sut.GetProperty(name, context).Should().BeNull(); }
public void ShouldThrowIfNameIsNullOnGetProperty(FakeDataProvider sut) { Action action = () => sut.GetProperty(null, null); action.ShouldThrow<ArgumentNullException>().WithMessage("*name"); }
public void ShouldGetProperty(FakeDataProvider sut, string name, string value, CallContext context) { sut.SetProperty(name, value, context); sut.GetProperty(name, context).Should().Be(value); }
public void ShouldSetPropertyAndReturnTrue(FakeDataProvider sut, string name, string value, CallContext context) { sut.SetProperty(name, value, context).Should().BeTrue(); }