public RoleRef (RoleBase role) { if(null == role) throw new ArgumentNullException("role"); Role = role; _refs = 0; }
public void Decrease_underZero_throwsInvalidOperationException() { // arrange: RoleBase role = MockRepository.GenerateStrictMock <RoleBase>(); RoleRef roleRef = new RoleRef(role); // assert: Assert.Throws <InvalidOperationException>(delegate { roleRef.Decrease(); }); }
public RoleRef(RoleBase role) { if (null == role) { throw new ArgumentNullException("role"); } Role = role; _refs = 0; }
public void Ctor_withRole_works() { // arrange: RoleBase role = MockRepository.GenerateStrictMock <RoleBase>(); // act: RoleRef roleRef = new RoleRef(role); // assert: Assert.AreSame(role, roleRef.Role); }
public void Dispose_willDisposeTheRole() { // arrange: RoleBase role = MockRepository.GenerateStrictMock <RoleBase>(); role.Expect(r => r.Dispose()).Repeat.Once(); RoleRef roleRef = new RoleRef(role); // assert: roleRef.Dispose(); }
public void Increase_increaseTheNumberOfReferences() { // arrange: RoleBase role = MockRepository.GenerateStrictMock <RoleBase>(); RoleRef roleRef = new RoleRef(role); // assert: for (int i = 0; i < 100; ++i) { Assert.AreEqual(i + 1, roleRef.Increase()); } }