public void Create_UserIsNotPartOfTheGroup_ThrowsException()
        {
            this.group.SetupGet(x => x.Users).Returns(new List <User>().AsReadOnly());

            Stop.Create(this.group.Object,
                        this.user.Object, "why");
        }
Example #2
0
        public void Init()
        {
            TimeProvider.Current = new TestTimeProvider(new DateTime(2015, 01, 25, 9, 0, 0));
            Guid tenantId = Guid.NewGuid();

            this.user = User.Create("idpID", "*****@*****.**", "Bob Smith", false);

            this.group = new Mock <Group>();
            this.group.SetupGet(x => x.Users).Returns(new List <User>()
            {
                user
            }
                                                      .AsReadOnly());

            this.stop = Stop.Create(this.group.Object, this.user, "why");
        }
        public void Create_AllInformationProvided_Succesfull()
        {
            this.group.SetupGet(x => x.Name).Returns("Phoenix");

            User user = User.Create("idpID", "*****@*****.**", "Bob Smith", false);

            Mock <User> userBob = new Mock <User>();

            userBob.SetupGet(x => x.FullName).Returns("Bob Smith");

            Mock <User> userJason = new Mock <User>();

            userJason.SetupGet(x => x.FullName).Returns("Jason Smith");

            this.group.SetupGet(x => x.Users).Returns(
                new List <User>()
            {
                user,
                userJason.Object
            }.AsReadOnly());

            Mock <Stop> expected = new Mock <Stop>();

            expected.SetupGet(x => x.Problem).Returns("build server");
            expected.SetupGet(x => x.By).Returns(user.FullName);
            expected.SetupGet(x => x.ById).Returns(user.Id);
            expected.SetupGet(x => x.GroupName).Returns("Phoenix");
            expected.SetupGet(x => x.GroupId).Returns(this.group.Object.Id);
            expected.SetupGet(x => x.Date).Returns(new DateTime(2015, 01, 25, 9, 0, 0));
            expected.SetupGet(x => x.GroupUsers).Returns(new List <string>()
            {
                user.FullName,
                "Jason Smith"
            }.AsReadOnly());
            expected.SetupGet(x => x.OverallDownTime).Returns(null as TimeSpan?);

            Stop actual = Stop.Create(group.Object, user, "build server");

            actual.ShouldBeEquivalentTo(expected.Object,
                                        options => options.Excluding(p => p.PropertyPath == "Id"));
        }
 public void Create_UserIsNull_ThrowsException()
 {
     Stop.Create(this.group.Object, null, "why");
 }
 public void Create_GroupIsNull_ThrowsException()
 {
     Stop.Create(null, this.user.Object, "why");
 }
 public void Create_WhyIsEmpty_ThrowsException()
 {
     Stop.Create(this.group.Object, this.user.Object, string.Empty);
 }