public void AttributesTest () { SerializableAttribute serializable_attr = new SerializableAttribute (); FlagsAttribute flags_attr = new FlagsAttribute (); CustomAttributeCollection attr_coll = new CustomAttributeCollection (serializable_attr, flags_attr); Attribute [] attributes = attr_coll.GetAttributes (); Assert.AreEqual (true, attributes != null, "#A0"); Assert.AreEqual (2, attributes.Length, "#A1"); // The property is supposed to be giving us the same instance in all the invocations Assert.AreSame (attributes, attr_coll.GetAttributes (), "#A2"); }
private static void AssertIsNullProbablyDoesSomethingUsefulButIDontKnowWhat() { object o = new FlagsAttribute(); var o2 = o as AttributeUsageAttribute; Assert.Null(o2); // TEST: I can't figure out a really sensible test for Assert.IsNull, but this seems to do // something. If Assert.IsNull has the attribute, o2 == null below *IS* flagged as "Expression // is always true" if (o2 == null) return; }
public void Execute_5_Dependencies() { _resolverMock.Resolve<string>().Returns("str-dep-1"); _resolverMock.Resolve<long>().Returns(42); _resolverMock.Resolve<int>().Returns(12); var dep4 = new FlagsAttribute(); _resolverMock.Resolve<FlagsAttribute>().Returns(dep4); var dep5 = new SystemException(); _resolverMock.Resolve<SystemException>().Returns(dep5); var queryMock = Substitute.For<IQuery<int, string, long, int, FlagsAttribute, SystemException>>(); _queryExecutor.Execute(queryMock); queryMock.Received().Execute("str-dep-1", 42, 12, dep4, dep5); }