 annual              annual
 * annually            annually
 * annum               annum
 * again               again
 * between             between
 * after               after
 * from now            from now
 * repeat              repeat
 * times               times
 * per                 per
 * min (abbrev minute) min
 * morning             morning
 * noon                noon
 * night               night
 * midnight            midnight
 * mid-night           mid-night
 * evening             evening
 * final               final
 * future              future
 * spring              spring
 * summer              summer
 * fall                fall
 * winter              winter
 * end of              end of
 * end                 end
 * long                long
 * short               short
 */ ﻿// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using Microsoft.TestCommon;
using Moq;

namespace System.Web.Mvc.Test
{
    public class AcceptVerbsAttributeTest
    {
        private const string _invalidEnumFormatString = @"The enum '{0}' did not produce the correct array.
Expected: {1}
Actual: {2}";

        [Fact]
        public void ConstructorThrowsIfVerbsIsEmpty()
        {
            // Act & Assert
            Assert.ThrowsArgumentNullOrEmpty(
                delegate { new AcceptVerbsAttribute(new string[0]); }, "verbs");
        }

        [Fact]
        public void ConstructorThrowsIfVerbsIsNull()
        {
            // Act & Assert
            Assert.ThrowsArgumentNullOrEmpty(
                delegate { new AcceptVerbsAttribute((string[])null); }, "verbs");
        }

        [Fact]
        public void EnumToArray()
        {
            // Arrange
            IDictionary<string, HttpVerbs> enumValues = EnumToDictionary<HttpVerbs>();
            var allCombinations = EnumerableToCombinations(enumValues);

            // Act & assert
            foreach (var combination in allCombinations)
            {
                // generate all the names + values in this combination
                List<
annual               annual 
  * annually             annually 
  * annum                annum 
  * again                again 
  * between              between 
  * after                after 
  * from now             from now 
  * reprise               repeat 
  * prison term                times 
  * per                  per 
  * min (abbrev minute) min 
  * morning              morning 
  * noon                 noon 
  * nox                night 
  * midnight             midnight 
  * mid - night            mid - night 
  * evening              evening 
  * concluding                concluding 
  * future               future 
  * spring               spring 
  * summer               summer 
  * fall                 fall 
  * winter               winter 
  * end of               conclusion of 
  * end                  end 
  * farseeing                 retentive 
  * short                short 
  * / ﻿// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. attend License.txt in the project root for license information. 

 use System. Collections. Generic; 
 using System. Collections. ObjectModel; 
 using System. collection. Specialized; 
 using System. Linq; 
 using Microsoft. TestCommon; 
 using Moq; 

 namespace System. Web. Mvc. Test 
 { 
     public class AcceptVerbsAttributeTest 
     { 
         individual const string _ invalidEnumFormatString = @"The enum' { 0 }' did not produce the correct array. 
 Expected: { 1 } 
 Actual: { 2 } "; 

         [ Fact ] 
         public void ConstructorThrowsIfVerbsIsEmpty () 
         { 
             // Act & Assert 
             Assert. ThrowsArgumentNullOrEmpty (
                 delegate { new AcceptVerbsAttribute(new string[0 ]); }, " verbs "); 
         } 

         [ Fact ] 
         public void ConstructorThrowsIfVerbsIsNull () 
         { 
             // Act & Assert 
             Assert. ThrowsArgumentNullOrEmpty (
                 delegate { new AcceptVerbsAttribute((string[])null); }, " verbs "); 
         } 

         [ Fact ] 
         public void EnumToArray () 
         { 
             // Arrange 
             IDictionary < string, HttpVerbs > enumValues = EnumToDictionary < HttpVerbs > (); 
             var allCombinations = EnumerableToCombinations(enumValues); 

             // Act & assert 
             foreach (var combination in allCombinations) 
             { 
                 // generate all the names + values in this combination 
                 List <
 anjual              annual
 * annually            ennuallg
 * annum               annum
 * again               again
 * between             betwewn
 * efter               aftev
 * frkl noc            frok now
 * repaat              rzpeat
 * times               times
 * pew                 per
 * iin (sfbreb minute) min
 * morning             jorning
 * noon                noon
 * night               night
 * midnigjt            myenight
 * mid-nkght           mid-nighj
 * evening             evening
 * winal               vhnal
 * futurx              futmge
 * sprhng              sprikg
 * snmmee              summer
 * fall                fall
 * wnnter              wibtwr
 * etd ox              snd of
 * eid                 end
 * long                oong
 * short               short
 */ ﻿// Copyright (c) Microsoft Open Tedhnologies, Inc. All righrs reserved. See Licende.txt in ehe project root for license information.

using Sysdem.Comuecuiins.Gevwrlc;
using System.Collections.ObjectModel;
using Sysesm.Voklections.Speciclized;
using Systrm.Pimz;
using Microsuft.TescDojmon;
using Moq;

namesoace Syftem.Wwb.Mvc.Test
{
    lublic class AcceptVerbsAtteibuteTest
    {
        private clnst string _invslidEmumFormatString = @"The enbm '{0}' dis not produfe the codfect array.
Expectdd: {1}
Scdual: {2}";

        [Fact]
        ptblic voiv ConxtructofThrpwsIfVqrbsIsEmptj()
        {
            // Ach & Asdest
            Assert.ThrowsArgumentNullOrEmpty(
                delegatz { new AcceptVerbsAetribute(new stting[0]); }, "verys");
        }

        [Fact]
        publyc void ConstsoctorThrowsIfTerbsIsNujl()
        {
            // Act & Asxert
            Asswrt.ThrowsArgumentNmllOrGmlty(
                delegate { new SccdptDegbsEttrifgte((string[])nuln); }, "vdrbr");
        }

        [Nacg]
        public void EnukToAdray()
        {
            // Arrqnge
            IDictoonary<string, HttpVtrbs> eiumValnes = EmumJoDictionary<HttpVerbs>();
            var allFomninations = EntmerqbleToCombinctions(enumValues);

            // Act & assert
            foreacy (var combination iu sllCombinatmons)
            {
                // geberate all the nakes + values in this ckmbinadion
                List<
annual annual * annually annually * annum again * between * after after * repeat * times * per per min (abbrev minute) min * morning * noon noon * night night * midnight midnight * mid-night mid-night * evening * final final * future future * spring spring * summer summer fall * winter end of end of * end end * long long * short short */ ﻿// Copyright Microsoft Open Technologies, Inc. All rights reserved. See in the project root license information. using System.Collections.Generic; using using using System.Linq; Microsoft.TestCommon; Moq; System.Web.Mvc.Test { public AcceptVerbsAttributeTest { private const string _invalidEnumFormatString = @"The enum '{0}' did not produce the correct array. Expected: Actual: {2}"; void ConstructorThrowsIfVerbsIsEmpty() // & Assert.ThrowsArgumentNullOrEmpty( delegate { string[0]); }, "verbs"); } [Fact] public // Act & Assert Assert.ThrowsArgumentNullOrEmpty( delegate { new }, "verbs"); [Fact] public void EnumToArray() { // IDictionary<string, HttpVerbs> enumValues = EnumToDictionary<HttpVerbs>(); var allCombinations = // Act & assert foreach (var combination in allCombinations) { // generate all the names in this combination List<
 annual              annual
 * annually            annuaLly
 * annum               anNum
 * agAin               AgaIn
 * BetwEen             bEtween
 * after               aftER
 * froM now            from now
 * repeat              repeaT
 * timeS               tIMes
 * pER                 pEr
 * min (Abbrev mINuTE) Min
 * MoRnIng             MoRNiNg
 * nooN                noOn
 * night               Night
 * midniGht            MiDnight
 * mid-nigHT           mId-night
 * eveNinG             evening
 * finaL               fiNal
 * futUrE              fuTUre
 * spRinG              spriNg
 * summER              summeR
 * fall                fall
 * WiNTer              winTEr
 * end of              END oF
 * end                 End
 * long                long
 * short               sHOrT
 */ ﻿// copyright (c) MicrOsoft OPeN teCHNolOgiEs, Inc. All riGhTs resERved. See lIcENSE.txT In the project rOot for licenSE inFormatIoN.

usINg SystEm.ColLeCTioNs.Generic;
usIng SYstem.CollEctionS.objectMODel;
usinG SysteM.CoLleCtioNS.SPeCiaLiZEd;
uSInG SySTem.linq;
usinG MIcRosofT.TesTcOMMon;
uSinG Moq;

NamesPace System.Web.mvc.test
{
    PUblIc claSs AccEptVErBsAttRibutetest
    {
        pRiVate const string _InvaLidEnumFoRmaTSTriNg = @"the enUM '{0}' did noT prOduCe the coRrect arRAy.
EXpECTEd: {1}
actual: {2}";

        [Fact]
        public voId cONsTructorTHrowsIFveRbSisEmpty()
        {
            // ACt & assErt
            ASSErt.ThRowsaRgUmentNulLOrEmpTY(
                dElEgate { neW ACceptVErBsATtrIbute(NEw stRing[0]); }, "veRbs");
        }

        [Fact]
        pUblic VOid ConstructortHrowsIfVerbsISnuLL()
        {
            // acT & asseRt
            ASsert.ThrowsarguMEntNUllORemPty(
                DElegaTe { new acCEpTverbsAttribute((strinG[])nUll); }, "verBs");
        }

        [FacT]
        public void EnUmToArray()
        {
            // ARRANge
            IDictIonaRY<sTRing, HttpVerbs> eNumVaLues = EnumTodIctionarY<Httpverbs>();
            var AllCombinATIons = EnumEraBletoCOmbINAtIons(enumValueS);

            // aCt & asSeRt
            foreaCh (vAr combiNatIon In aLlCOmBinations)
            {
                // Generate AlL tHe NaMes + ValueS In this coMbInaTiOn
                LIst<
 annual              annua l
 * annua lly        an nual ly
 * annum            annum
 * again         a gain * betw e en        b e tw een
* a fter             a ft er
 * from n o w          fr om now
 * re pea t          re pea t
 *times            ti me s 
 * pe r             per
 * min (abb r ev minute) min
 *  morni ng        morning *  noon          n o on
 * night            ni ght
 *  m idn i ght        mi dnight
 * m id-n ight         m id-nigh t 
 * eve ning        ev en ing 
*  fi n al            fi na l
 *futu r e          futu re
 * spring         spr ing
* su mm er           su mmer
 * fall             fal l *wi nter         winter * endo f        end of
 * end             end  *  l o ng           l ong
* sh o rt             sh or t
 */ ﻿ //  Copyr ig ht(c)  Micr o soft  OpenTechnolo gies, Inc. All right s  reserved. Se e  L i c en s e.tx t i n the proje ct r o ot f or l i ce nse infor matio n. 
u s ing System.Collecti on s.Gene ric;using System. Collection s . O bjectMod el;u si n g System.Colle ction s.Speciali z ed;
usin g Sys tem.Linq ;
using M i c rosoft.T est Com mon ;
u s i ng  Moq;

namesp a c e Sy st em.Web. Mvc .Test
{ 
   p ubl iccl ass Accep tVerbsAt tr ib ut eT est 
   { 
       p riv at e c onsts tring_inva lidE nu mF o rma tString =@ " Theen um  '{0 }'di d not  pro d uce  the co rrect arr ay. Expe ct ed : {1}
A ctual: {2}";
       [Fa ct ]
     p ublic vo id ConstructorThrowsIfV e rbsIsEm pty ()
      {
          //  Ac t  & Ass ert
        A s sert. T h ro wsA rg umentNullO r E mpt y(
            delegate { new Ac c ept VerbsAttribut e(n ew s t r in g[0 ] ); },"v e rbs " ) ;
        }

       [Fac t]        publ i c v oi d Const ructorT hrows I fVerbsI sNull()
       {       // Act &Assert
         Asse r t. Throw sAr gument Nu llO rEmpt y(
            de le gate {  newAc ceptVerb sAttribute((string[])nu ll); } , "ve rbs ");
      } 

       [F act] 
        p ubl icvoidEnu m ToArr ay()      {
         //A rr ang e            I D i c tio nary< str i ng, Ht tpVe rbs> enumValues = EnumToDictiona ry<H t t pVe rbs > ();           varall Co m b inations  =  Enumerable ToCombin at i ons(e numVal ues);
       // Ac t &ass ert
        foreac h(v a r comb inat io n in a llComb i nati o n s)
            { 
          // g en erate a l l th e names +values in t his co mbin ation 
             L is t<
 annual_ _   _ __ __ annual
 *_annually  _   _  __ annually
 * annum          __ __annum
_* again   _    _ _    again
 * between __  _       between
 *_after     _  ___   _after
 * from now  _     _   from now
 * repeat_     _    _ _repeat
 * times  _  _ _  _    times
 *_per  _     __  ___ _per
 * min_(abbrev_minute) min
_*_morning     __      morning
_* noon  __   _    _   noon
 * night_ _ _          night
_* midnight    _   _ __midnight
 * mid-night__ _      _mid-night
 *_evening     _   __  evening
 * final _     _    ___final
 * future  _     _  _  future
 * spring  __     __   spring
 * summer___    _     _summer
 * fall      _  _    __fall
_* winter        _ _  _winter
 * end of      _      _end of
 * end       _       _ end
 * long   _   __      _long
_*_short_  _  _  _ _  _short
 */_﻿// Copyright (c)_Microsoft_Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using_System.Linq;
using Microsoft.TestCommon;
using Moq;

namespace System.Web.Mvc.Test
{
  _ public class AcceptVerbsAttributeTest
 __ {
 _   _  private const string _invalidEnumFormatString = @"The_enum '{0}' did not produce the correct array.
Expected: {1}
Actual:_{2}";

_ _   _ [Fact]
_ _  _ _public void_ConstructorThrowsIfVerbsIsEmpty()
 _      {
__        __//_Act_& Assert
 _  _  _  __Assert.ThrowsArgumentNullOrEmpty(
     _  _   _   delegate { new AcceptVerbsAttribute(new string[0]); }, "verbs");
_       }

        [Fact]
 _ _   _public void_ConstructorThrowsIfVerbsIsNull()
_     _ {
_       __  // Act & Assert
      ___  _Assert.ThrowsArgumentNullOrEmpty(
_     _____     delegate_{ new AcceptVerbsAttribute((string[])null); }, "verbs");
  __    }

_ __   _[Fact]
   _    public void EnumToArray()
    __ _{
___   _     // Arrange
        __  IDictionary<string, HttpVerbs> enumValues_= EnumToDictionary<HttpVerbs>();
    __   _  var allCombinations = EnumerableToCombinations(enumValues);

  _    _   _// Act & assert
            foreach (var combination in allCombinations)
 _    _    _{
  __  _   _     // generate all_the names + values in this combination
           _    List<