public void NullReturnValueReturnsTrue(SUT sut, IInvocation invocation)
        {
            invocation.ReturnValue = null;

            var result = sut.ShouldIntercept(invocation);

            result.Should().BeTrue();
        }
        public void InvocationReturnValueIsSetToFactoryFunctionResult(IInvocation invocation, object obj)
        {
            var sut = new SUT(_ => obj);

            sut.Intercept(invocation);

            invocation.ReturnValue.Should().Be(obj);
        }
        public void ReturnValueReturnsFalse(object returnValue, SUT sut, IInvocation invocation)
        {
            invocation.ReturnValue = null;

            var result = sut.ShouldIntercept(invocation);

            result.Should().BeFalse();
        }
        public void ReturnsFalseOnSetter(SUT sut, IInvocation invocation)
        {
            invocation.Method.Returns(typeof(Foo).GetProperty("Bar").GetSetMethod());

            var result = sut.ShouldIntercept(invocation);

            result.Should().BeFalse();
        }
        public void NonNullReturnValueReturnsFalse(SUT sut, IInvocation invocation, object value)
        {
            invocation.ReturnValue = value;

            var result = sut.ShouldIntercept(invocation);

            result.Should().BeFalse();
        }
        public void ReturnsTrueWhenRequestIsInterceptorArray(SUT sut)
        {
            var field = typeof(ObjectWithField).GetField("Interceptors");

            var result = sut.IsSatisfiedBy(field);

            result.Should().BeTrue();
        }
        public void ReturnsFalseWhenDeclaringTypeNotRegistered([Frozen] IEntityTypesProvider typesProvider, SUT sut)
        {
            typesProvider.GetTypes().Returns(new[] { typeof(Bar) });
            var property = typeof (Foo).GetProperty("Bar");

            var result = sut.IsSatisfiedBy(property);

            result.Should().BeFalse();
        }
        public void ReturnsTrueWhenBothTypesRegistered([Frozen] IEntityTypesProvider typesProvider, SUT sut)
        {
            typesProvider.GetTypes().Returns(new[] { typeof(Foo), typeof(Bar) });
            var property = typeof(Foo).GetProperty("Bar");

            var result = sut.IsSatisfiedBy(property);

            result.Should().BeTrue();
        }
        public void ReturnsTrueWhenPropertyIsCollection([Frozen] IEntityTypesProvider typesProvider, SUT sut)
        {
            typesProvider.GetTypes().Returns(new[] { typeof(Qux), typeof(Bar) });
            var property = typeof(Bar).GetProperty("Quxes");

            var result = sut.IsSatisfiedBy(property);

            result.Should().BeTrue();
        }
        public void NonEmptyCollectionReturnsFalse(SUT sut, IInvocation invocation, ICollection<object> collection)
        {
            collection.Should().NotBeEmpty();

            invocation.ReturnValue = collection;

            var result = sut.ShouldIntercept(invocation);

            result.Should().BeFalse();
        }
        public void EmptyCollectionReturnsTrue(SUT sut, IInvocation invocation, ICollection<object> collection)
        {
            collection.Clear();

            invocation.ReturnValue = collection;

            var result = sut.ShouldIntercept(invocation);

            result.Should().BeTrue();
        }
        public void SetsParentIdWhenPropertyExists(SUT sut, IInvocation invocation, int fooId)
        {
            var foo = new Foo() { Id = fooId };
            var bar = new Bar();

            invocation.InvocationTarget.Returns(foo);
            invocation.ReturnValue = bar;

            sut.Intercept(invocation);

            bar.FooId.Should().Be(foo.Id);
        }
        public void SetsParentIdWhenPropertyExistsWhenTableNameId(SUT sut, IInvocation invocation, int farId)
        {
            var far = new Far() { FarId = farId };
            var boo = new Boo();

            invocation.InvocationTarget.Returns(far);
            invocation.ReturnValue = boo;

            sut.Intercept(invocation);

            boo.FarId.Should().Be(far.FarId);
        }
        public void SetsIdOnMatchingProperty(SUT sut, IInvocation invocation, int barId)
        {
            var foo = new Foo { BarId = barId };
            var bar = new Bar();

            invocation.Method.Returns(foo.GetType().GetProperty("Bar").GetGetMethod());
            invocation.InvocationTarget.Returns(foo);
            invocation.ReturnValue = bar;

            sut.Intercept(invocation);

            bar.Id.Should().Be(barId);
        }
        public void SetsIdOnMatchingPropertyWhenTableNameId(SUT sut, IInvocation invocation, int booId)
        {
            var far = new Far { BooId = booId };
            var boo = new Boo();

            invocation.Method.Returns(far.GetType().GetProperty("Boo").GetGetMethod());
            invocation.InvocationTarget.Returns(far);
            invocation.ReturnValue = boo;

            sut.Intercept(invocation);

            boo.BooId.Should().Be(booId);
        }
        public void InvocationIsPassedToObjectFactory(IInvocation expected, object obj)
        {
            IInvocation passedInvocation = null;

            Func<IInvocation, object> func = i =>
            {
                passedInvocation = i;
                return obj;
            };

            var sut = new SUT(func);

            sut.Intercept(expected);

            passedInvocation.Should().Be(expected);
        }
        public void SetsPropertyOnValueReturn(SUT sut, IInvocation invocation)
        {
            // Setup fixture
            var foo = new Foo();
            var bar = new Bar();
            invocation.Method.Returns(foo.GetType().GetProperty("Bar").GetGetMethod());

            invocation.InvocationTarget.Returns(foo);
            invocation.ReturnValue = bar;

            // Exercise system
            sut.Intercept(invocation);

            // Verify outcome
            foo.Bar.Should().Be(bar);
        }
        protected virtual void WithHttpRequestFor(QueryViewRequest query, Action <HttpRequest> a)
        {
            var req = SUT.Create(query);

            a(req);
        }
 public void ThrowsOnNullRequest(SUT sut)
 {
     sut.Invoking(s => s.IsSatisfiedBy(null))
         .ShouldThrow<ArgumentNullException>();
 }
示例#20
0
 protected override void When()
 {
     SUT.SetRestingCycle(new Dictionary <int, bool> {
         { 1, false }, { 2, true }, { 3, true }, { 4, true }, { 5, true }, { 6, true }, { 7, true }
     }, It.IsAny <DateTime>());
 }
 protected override void When()
 {
     SUT.SetDailyRepetitions(75, It.IsAny <DateTime>());
 }
示例#22
0
        public void When_POST_of_new_document_The_document_is_persisted()
        {
            var response = SUT.PostAsync(ClientTestData.Artists.Artist1Json).Result;

            response.Should().BeSuccessfulPost(ClientTestData.Artists.Artist1Id);
        }
 public void Given_the_Seleno_Application_has_already_been_run()
 {
     SUT.Run(c => {});
 }
        public void ReturnsFalseWhenRequestIsNotFieldInfo(SUT sut, object request)
        {
            var result = sut.IsSatisfiedBy(request);

            result.Should().BeFalse();
        }
        public void Eine_Exception_auslösen() {
            var sut = new SUT();
            Isolate.WhenCalled(() => sut.ReadContent()).WillThrow(new Exception());

            Assert.That(sut.FormatContent(), Is.EqualTo("Eine Ausnahme..."));
        }
示例#26
0
 public void then_it_knows_the_user_is_authenticated()
 {
     SUT.FindDisplayFor <AboutViewModel>()
     .DisplayFor(m => m.User.UserName).Text.ShouldEqual("*****@*****.**");
 }
示例#27
0
 protected override void When()
 {
     //change to base url to the subdomain
     MvcWebApp.BaseUrl = "http://global.mylocaldomain.com";
     SUT.NavigateTo <HomeController>(c => c.Global());
 }
示例#28
0
 public void then_it_displays_the_current_day_of_the_week()
 {
     SUT.FindDisplayFor <AboutViewModel>()
     .DisplayFor(m => m.DayOfWeek).Text.ShouldEqual(DateTime.Today.DayOfWeek.ToString());
 }
示例#29
0
 protected override void When()
 {
     SUT.NavigateTo <AccountController>(c => c.LogOff());
     SUT.NavigateTo <HomeController>(c => c.About());
 }
 protected override void When()
 {
     SUT.UpdateQuantity(ExistingItemName, NewQuantity);
 }
        public void When_passing_db_name_It_should_generate_a_relative_url()
        {
            var r = SUT.Create(new QueryViewRequest("my_design_doc", "my_view"));

            r.RelativeUrl.Should().Be("/_design/my_design_doc/_view/my_view");
        }
示例#32
0
 public void Ein_bekanntes_Token_wird_korrekt_aufgeloest()
 {
     SUT()(new Query(DemoData.Token1)).Result.Should().Be(DemoData.Abfrage(new Query(DemoData.Token1)).Result);
     SUT()(new Query(DemoData.Token2)).Result.Should().Be(DemoData.Abfrage(new Query(DemoData.Token2)).Result);
 }
 public void SutIsInterceptor(SUT sut)
 {
     sut.Should().BeAssignableTo<IInterceptor>();
 }
        protected override void When()
        {
            base.When();

            _result = SUT.AddAsync(AdminUserId, _model).Result;
        }
示例#35
0
 protected override void When()
 {
     Result = SUT.InterpretMessage(Json);
 }
示例#36
0
 protected override void When()
 {
     Response = SUT.SendAsyncInternal(_request, new CancellationToken()).Result;
     base.When();
 }
示例#37
0
 public void When_the_order_is_placed()
 {
     _result = SUT.OrderDrink(_drinkName, _shouldAddMilk, _shouldAddSugar);
 }
示例#38
0
        protected override void When()
        {
            base.When();

            _models = SUT.GetAsync(AdminUserId).Result;
        }
 public void SutIsInterceptionPolicy(SUT sut)
 {
     sut.Should().BeAssignableTo<IInterceptionPolicy>();
 }
 public void When_getting_selected_radio_button()
 {
     SUT.SelectedButtonInRadioGroup(_radioGroupPropertySelector);
 }
示例#41
0
 protected override void When()
 {
     SUT.IndicateTyping(_chatHub).Wait();
 }
示例#42
0
 protected override void When()
 {
     SUT.NavigateTo <HomeController>(c => c.About());
 }
示例#43
0
 protected override void When()
 {
     _result = SUT.Process(new Order {
         PartNumber = "TestPart", Quantity = -1
     });
 }
示例#44
0
 public void then_you_can_get_the_full_page_text()
 {
     SUT.AllText().ShouldContain("Our business days are");
 }
 public void SutIsRequestSpecification(SUT sut)
 {
     sut.Should().BeAssignableTo<IRequestSpecification>();
 }
 protected override void When()
 {
     SUT.Activate(It.IsAny <DateTime>());
 }
        public void When_passing_db_name_and_list_name_It_should_generate_a_relative_url()
        {
            var r = SUT.Create(new QueryViewRequest("my_design_doc", "my_view").Configure(c => c.WithList("mylist")));

            r.RelativeUrl.Should().Be("/_design/my_design_doc/_list/mylist/my_view");
        }
        protected virtual void WithHttpRequestFor(GetChangesRequest request, Action <HttpRequest> a)
        {
            var req = SUT.Create(request);

            a(req);
        }
示例#49
0
 protected void When_processing_an_order_with_a_negative_quantity()
 {
     _result = SUT.Process(new Order {
         PartNumber = "TestPart", Quantity = -1
     });
 }
示例#50
0
        public void When_PUT_of_new_document_The_document_is_replaced()
        {
            var response = SUT.PutAsync(ClientTestData.Artists.Artist1Id, ClientTestData.Artists.Artist1Json).Result;

            response.Should().BeSuccessfulPutOfNew(ClientTestData.Artists.Artist1Id);
        }
 public void ThrowsOnNullInvocation(SUT sut)
 {
     sut.Invoking(s => s.Intercept(null))
         .ShouldThrow<ArgumentNullException>();
 }
示例#52
0
        public void When_HEAD_of_non_existing_document_The_response_is_empty()
        {
            var response = SUT.HeadAsync("fooId").Result;

            response.Should().BeHead404("fooId");
        }
示例#53
0
 public void When_setting_an_attribute_value()
 {
     SUT.SetAttribute(_propertySelector, AttributeName, AttributeValue);
 }
示例#54
0
 public void Ein_unbekanntes_Token_wird_als_nicht_gefunden_gemeldet()
 {
     SUT()(new Query("sagdhsa785d6aszuidsa78d6tzsajkldusa78tdzhasda")).Result.Should().Be(NotFound.Instance);
 }