public void Can_correctly_gets_application_instances_by_host_header() { var instance1 = new ApplicationInstance(); var instance2 = new ApplicationInstance(); var instances = new[] { instance1, instance2 }; var criteria = new CriterionSet(); criteria.AddCriterion(new Criterion("UniqueHostHeader", "MyHostHeader")); var mocks = new MockRepository(); var objectRepository = mocks.CreateMock <IPersistentObjectRepository>(); using (mocks.Record()) { objectRepository.ConfigurationFile = "webmanagement.hibernate.cfg.xml"; Expect.Call(objectRepository.FindAll <ApplicationInstance>(criteria)).Return(instances); } using (mocks.Playback()) { IApplicationInstanceRepository repository = new ApplicationInstanceRepository(objectRepository); IEnumerable <ApplicationInstance> actualInstances = repository.GetByHostHeader("MyHostHeader"); EnumerableAssert.That(actualInstances, Is.EqualTo(instances)); } }
public void CorrectlyRetrievesAllEnumeratedValuesForAGivenEnumerationType() { IEnumerationHelper helper = new EnumerationHelper(); IEnumerable <PersistenceMode> modes = helper.GetAll <PersistenceMode>(); EnumerableAssert.That(modes, Is.EquivalentTo(new PersistenceMode[] { PersistenceMode.Live, PersistenceMode.Archive })); }
public void Should_return_all_enumerated_values() { IEnumerable <TestEnumeration> values = Enumeration.GetAll <TestEnumeration>(); EnumerableAssert.That(values, Has.Count(2)); EnumerableAssert.Contains(values, TestEnumeration.Red); EnumerableAssert.Contains(values, TestEnumeration.Blue); }
public void Correctly_determines_rebuild_actions() { IDatabaseActionResolver resolver = new DatabaseActionResolver(); IEnumerable <DatabaseAction> actions = resolver.GetActions(RequestedDatabaseAction.Rebuild); EnumerableAssert.That(actions, Is.EqualTo(new DatabaseAction[] { DatabaseAction.Drop, DatabaseAction.Create, DatabaseAction.Update })); }
public void Correctly_determines_drop_actions() { IDatabaseActionResolver resolver = new DatabaseActionResolver(); IEnumerable <DatabaseAction> actions = resolver.GetActions(RequestedDatabaseAction.Drop); EnumerableAssert.That(actions, Is.EqualTo(new DatabaseAction[] { DatabaseAction.Drop })); }
public void Should_return_all_enumerated_values_from_type() { IEnumerable values = Enumeration.GetAll(typeof(TestEnumeration)); var strongTypeValues = new List <TestEnumeration>(); foreach (var enumValue in values) { strongTypeValues.Add((TestEnumeration)enumValue); } EnumerableAssert.That(strongTypeValues, Has.Count(2)); EnumerableAssert.Contains(strongTypeValues, TestEnumeration.Red); EnumerableAssert.Contains(strongTypeValues, TestEnumeration.Blue); }
public void Can_correctly_gets_all_application_instances() { var instance1 = new ApplicationInstance(); var instance2 = new ApplicationInstance(); var instances = new[] { instance1, instance2 }; var mocks = new MockRepository(); var objectRepository = mocks.CreateMock <IPersistentObjectRepository>(); using (mocks.Record()) { objectRepository.ConfigurationFile = "webmanagement.hibernate.cfg.xml"; Expect.Call(objectRepository.GetAll <ApplicationInstance>()).Return(instances); } using (mocks.Playback()) { IApplicationInstanceRepository repository = new ApplicationInstanceRepository(objectRepository); IEnumerable <ApplicationInstance> actualInstances = repository.GetAll(); EnumerableAssert.That(actualInstances, Is.EqualTo(instances)); } }