public void Full_proverb()
    {
        var strings = new[]
        {
            "nail",
            "shoe",
            "horse",
            "rider",
            "message",
            "battle",
            "kingdom"
        };
        var expected = new[]
        {
            "For want of a nail the shoe was lost.",
            "For want of a shoe the horse was lost.",
            "For want of a horse the rider was lost.",
            "For want of a rider the message was lost.",
            "For want of a message the battle was lost.",
            "For want of a battle the kingdom was lost.",
            "And all for the want of a nail."
        };

        Assert.Equal(expected, Proverb.Recite(strings));
    }
    public void Zero_pieces()
    {
        var strings  = Array.Empty <string>();
        var expected = Array.Empty <string>();

        Assert.Equal(expected, Proverb.Recite(strings));
    }
        public void Post([FromBody] Proverb newProverb)
        {
            ProverbContext context = new ProverbContext();

            context.Proverbs.Add(newProverb);
            context.SaveChanges();
        }
Exemple #4
0
    public void One_piece()
    {
        var expected = new[]
        {
            "And all for the want of a nail."
        };

        Assert.Equal(expected, Proverb.Recite(new[] { "nail" }));
    }
Exemple #5
0
    public void Two_pieces()
    {
        var expected = new[]
        {
            "For want of a nail the shoe was lost.",
            "And all for the want of a nail."
        };

        Assert.Equal(expected, Proverb.Recite(new[] { "nail", "shoe" }));
    }
Exemple #6
0
    public void All_lines()
    {
        const string expected = "For want of a nail the shoe was lost.\n" +
                                "For want of a shoe the horse was lost.\n" +
                                "For want of a horse the rider was lost.\n" +
                                "For want of a rider the message was lost.\n" +
                                "For want of a message the battle was lost.\n" +
                                "For want of a battle the kingdom was lost.\n" +
                                "And all for the want of a horseshoe nail.";

        Assert.That(Proverb.AllLines(), Is.EqualTo(expected));
    }
Exemple #7
0
    public void Four_pieces_modernized()
    {
        var expected = new[]
        {
            "For want of a pin the gun was lost.",
            "For want of a gun the soldier was lost.",
            "For want of a soldier the battle was lost.",
            "And all for the want of a pin."
        };

        Assert.Equal(expected, Proverb.Recite(new[] { "pin", "gun", "soldier", "battle" }));
    }
    public void Three_pieces()
    {
        var strings = new[]
        {
            "nail",
            "shoe",
            "horse"
        };
        var expected = new[]
        {
            "For want of a nail the shoe was lost.",
            "For want of a shoe the horse was lost.",
            "And all for the want of a nail."
        };

        Assert.Equal(expected, Proverb.Recite(strings));
    }
Exemple #9
0
 public void Line_one()
 {
     Assert.That(Proverb.Line(1), Is.EqualTo("For want of a nail the shoe was lost."));
 }
Exemple #10
0
 public void Full_proverb()
 {
     Assert.Equal(new[] { "For want of a nail the shoe was lost.", "For want of a shoe the horse was lost.", "For want of a horse the rider was lost.", "For want of a rider the message was lost.", "For want of a message the battle was lost.", "For want of a battle the kingdom was lost.", "And all for the want of a nail." }, Proverb.Recite(new[] { "nail", "shoe", "horse", "rider", "message", "battle", "kingdom" }));
 }
Exemple #11
0
 public void Line_four()
 {
     Assert.Equal("For want of a rider the message was lost.", Proverb.Line(4));
 }
Exemple #12
0
 public void Line_seven()
 {
     Assert.Equal("And all for the want of a horseshoe nail.", Proverb.Line(7));
 }
Exemple #13
0
 public void Line_one()
 {
     Assert.Equal("For want of a nail the shoe was lost.", Proverb.Line(1));
 }
Exemple #14
0
        static void Main(string[] args)
        {
            ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => { return(true); };

            string subject       = string.Format("Dnevni menu za {0}", DateTime.Today.ToString("dd.MM.yyyy"));
            string doubleNewLine = Environment.NewLine + Environment.NewLine;
            var    body          = new StringBuilder(
                string.Format("Pozdravljeni, {0}{1}", doubleNewLine,
                              string.Format("{0}{1}", "Napočila je 10.30 ura, kar pomeni,",
                                            string.Format(
                                                " da se bliža malica. Moja dolžnost je, da Vam za dan, {0}, v emailu pošljem dnevne menije vaših najljubših restavracij: ",
                                                DateTime.Today.ToLongDateString()))));

            try
            {
                body.Append(string.Format("{0}{1}{0}{2}", doubleNewLine, GetBarbadoMenu(), Environment.NewLine));
            }
            catch (Exception ex)
            {
                body.AppendLine(ex.ToString());
            }

            try
            {
                body.Append(string.Format("<br>{1}{0}", Environment.NewLine, GetFavolaMenu()));
            }
            catch (Exception ex)
            {
                body.AppendLine(ex.ToString());
            }

            try
            {
                body.Append(string.Format("{1}{0}", Environment.NewLine, GetPiapMenu()));
            }
            catch (Exception ex)
            {
                body.AppendLine(ex.ToString());
            }

            try
            {
                body.Append(string.Format("<b>Tiskarna:</b>{0}{1}{2}", doubleNewLine, GetTiskarnaMenu(), doubleNewLine));
            }
            catch (Exception ex)
            {
                body.AppendLine(ex.ToString());
            }

            body.AppendLine(
                string.Format("<hr>{1}{0}{1}",
                              string.Format("Želim Vam dober tek. Kot pravi stari Slovenski pregovor: {0}<b>{1}</b>",
                                            doubleNewLine, Proverb.GetRandomProverb()),
                              Environment.NewLine));
            body.Append(
                string.Format(
                    @"Lep pozdrav, {0}<b><font size = ""6"" color = ""blue"">MonoMenu</font></b> (<a href=""https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHDH5LFQB89WG"">doniraj za podporo novih restavracij?</a>)",
                    doubleNewLine));
            SendMail(subject, body.ToString());
            Console.ReadLine();
        }
Exemple #15
0
 public void Three_pieces()
 {
     Assert.Equal(new[] { "For want of a nail the shoe was lost.", "For want of a shoe the horse was lost.", "And all for the want of a nail." }, Proverb.Recite(new[] { "nail", "shoe", "horse" }));
 }
Exemple #16
0
 public void Line_seven()
 {
     Assert.That(Proverb.Line(7), Is.EqualTo("And all for the want of a horseshoe nail."));
 }
Exemple #17
0
 public void Line_four()
 {
     Assert.That(Proverb.Line(4), Is.EqualTo("For want of a rider the message was lost."));
 }
Exemple #18
0
 public void Zero_pieces()
 {
     Assert.Empty(Proverb.Recite(new string[0]));
 }
Exemple #19
0
 public void One_piece()
 {
     Assert.Equal(new[] { "And all for the want of a nail." }, Proverb.Recite(new[] { "nail" }));
 }