Exemple #1
0
        public void ContainsOnly_WithNonEmptyEntity()
        {
            var entity = m_Manager.CreateEntity(typeof(EcsTestData), typeof(EcsTestData2));

            Assert.DoesNotThrow(() =>
                                EntitiesAssert.ContainsOnly(m_Manager, EntityMatch.Any(entity)));

            Assert.Throws <AssertionException>(() =>
                                               EntitiesAssert.ContainsOnly(m_Manager, EntityMatch.Exact <EcsTestData>(entity)));
            Assert.DoesNotThrow(() =>
                                EntitiesAssert.ContainsOnly(m_Manager, EntityMatch.Partial <EcsTestData>(entity)));
            Assert.DoesNotThrow(() =>
                                EntitiesAssert.ContainsOnly(m_Manager, EntityMatch.Exact <EcsTestData, EcsTestData2>(entity)));
            Assert.DoesNotThrow(() =>
                                EntitiesAssert.ContainsOnly(m_Manager, EntityMatch.Partial <EcsTestData, EcsTestData2>(entity)));
            Assert.Throws <AssertionException>(() =>
                                               EntitiesAssert.ContainsOnly(m_Manager, EntityMatch.Exact <EcsTestData, EcsTestData2, EcsTestData3>(entity)));
            Assert.Throws <AssertionException>(() =>
                                               EntitiesAssert.ContainsOnly(m_Manager, EntityMatch.Partial <EcsTestData, EcsTestData2, EcsTestData3>(entity)));

            Assert.Throws <AssertionException>(() =>
                                               EntitiesAssert.ContainsOnly(m_Manager, EntityMatch.Exact <EcsTestData>()));
            Assert.DoesNotThrow(() =>
                                EntitiesAssert.ContainsOnly(m_Manager, EntityMatch.Partial <EcsTestData>()));
            Assert.DoesNotThrow(() =>
                                EntitiesAssert.ContainsOnly(m_Manager, EntityMatch.Exact <EcsTestData, EcsTestData2>()));
            Assert.DoesNotThrow(() =>
                                EntitiesAssert.ContainsOnly(m_Manager, EntityMatch.Partial <EcsTestData, EcsTestData2>()));
            Assert.Throws <AssertionException>(() =>
                                               EntitiesAssert.ContainsOnly(m_Manager, EntityMatch.Exact <EcsTestData, EcsTestData2, EcsTestData3>()));
            Assert.Throws <AssertionException>(() =>
                                               EntitiesAssert.ContainsOnly(m_Manager, EntityMatch.Partial <EcsTestData, EcsTestData2, EcsTestData3>()));
        }
Exemple #2
0
        public void ContainsOnly_WithMultipleEntityMatches_Throws()
        {
            var ex = Assert.Throws <ArgumentException>(() =>
                                                       EntitiesAssert.ContainsOnly(m_Manager, EntityMatch.Exact(new Entity {
                Index = 1
            }, new Entity {
                Index = 2
            })));

            StringAssert.Contains("multiple Entity", ex.Message);

            ex = Assert.Throws <ArgumentException>(() =>
                                                   EntitiesAssert.ContainsOnly(m_Manager, EntityMatch.Partial(new Entity {
                Index = 1
            }, new Entity {
                Index = 2
            })));
            StringAssert.Contains("multiple Entity", ex.Message);
        }
Exemple #3
0
 public void ContainsOnly_WithNullTypeMatch_Throws()
 {
     Assert.Throws <ArgumentNullException>(() =>
                                           EntitiesAssert.ContainsOnly(m_Manager, EntityMatch.Exact(null)));
     Assert.Throws <ArgumentNullException>(() =>
                                           EntitiesAssert.ContainsOnly(m_Manager, EntityMatch.Exact <EcsTestData>(null)));
     Assert.Throws <ArgumentNullException>(() =>
                                           EntitiesAssert.ContainsOnly(m_Manager, EntityMatch.Partial(null)));
     Assert.Throws <ArgumentNullException>(() =>
                                           EntitiesAssert.ContainsOnly(m_Manager, EntityMatch.Partial <EcsTestData>(null)));
 }