using System; using System.Linq; namespace Solution{ public class ToAscii { public static int GetAsciiSum(string s) => s.Sum(x => x); } }
- using System;
- using System.Linq;
- namespace Solution{
public class ToAsci- public class ToAscii
- {
public static int getAsciSum(string s) => s.ToList().Sum(e => (int)e);- public static int GetAsciiSum(string s) => s.Sum(x => x);
- }
- }
namespace Solution { using NUnit.Framework; using System; [TestFixture] public class SolutionTest { [Test] public void MyTest() { Assert.AreEqual(448, ToAscii.GetAsciiSum("test")); Assert.AreEqual(97, ToAscii.GetAsciiSum("a")); Assert.AreEqual(2286, ToAscii.GetAsciiSum("Some Words and numbers 453")); Assert.AreEqual(730, ToAscii.GetAsciiSum("&@Sp15, R@m")); } } }
- namespace Solution {
- using NUnit.Framework;
- using System;
// TODO: Replace examples and use TDD development by writing your own tests- [TestFixture]
- public class SolutionTest
- {
- [Test]
- public void MyTest()
- {
Assert.AreEqual(448, ToAsci.getAsciSum("test"));Assert.AreEqual(97, ToAsci.getAsciSum("a"));Assert.AreEqual(2286, ToAsci.getAsciSum("Some Words and numbers 453"));Assert.AreEqual(730, ToAsci.getAsciSum("&@Sp15, R@m"));- Assert.AreEqual(448, ToAscii.GetAsciiSum("test"));
- Assert.AreEqual(97, ToAscii.GetAsciiSum("a"));
- Assert.AreEqual(2286, ToAscii.GetAsciiSum("Some Words and numbers 453"));
- Assert.AreEqual(730, ToAscii.GetAsciiSum("&@Sp15, R@m"));
- }
- }
- }