Esempio n. 1
0
 public SlaveTokenCreatorTest(string name, SlaveTokenCreatorFixture fixture)
 {
     this._fixture          = fixture;
     _master                = mock(typeof(Master));
     _requestContext        = new RequestContext(1, 2, 3, 4, 5);
     this._name             = "Poke";
     _requestContextFactory = new ConstantRequestContextFactory(_requestContext);
     _tokenCreator          = fixture.Build(_master, _requestContextFactory);
 }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldThrowIfCreateThrowsAnException()
        public virtual void ShouldThrowIfCreateThrowsAnException()
        {
            // GIVEN
            Exception            re = new Exception("IO");
            AbstractTokenCreator throwingCreator = spy(creator);

            doThrow(re).when(throwingCreator).create(any(typeof(Master)), any(typeof(RequestContext)), anyString());

            try
            {
                // WHEN
                throwingCreator.CreateToken("A");
                fail("Should have thrown");
            }
            catch (Exception e)
            {
                // THEN
                assertEquals(re, e);
            }
        }